Repository navigation
feat: council-review-action runtime sandbox and review fixes - #425
Conversation
Enforce runtime tool restrictions for the council-review-action using OpenCode's permission system: - OPENCODE_CONFIG_CONTENT permission config denies bash, edit, webfetch, websearch, skill at the runtime level - --pure flag isolates external MCP plugins - Explicit deny of ask-default permissions (external_directory, doom_loop) for headless CI - Migrate 9 Divisor agents from deprecated tools: to permission: frontmatter syntax; sync scaffold assets Documentation: - Add docs/quickstart.md, docs/architecture.md - Rewrite README (benefit-first, inputs near top, fix comment posting accuracy) - Add A7 (npm supply chain) to security risk register - Fix stale ADR-001 trade-off, design.md version reference - Add CHANGELOG entry for sandbox change Testing: - Add 5 tests (Tests 27-31): MAX_PARSE_ATTEMPTS, noise filter categories, empty comments, rename headers, special chars (60 to 73 assertions) - Fix extract-review-json.py: with statement, encoding, optional filename argument - Add python3/jq pre-flight check, prefetch.sh API timeout - Remove dead AGENT_MODE from test invocations Spec: openspec/changes/council-review-sandbox/ Signed-off-by: sonupreetam <[email protected]>
shellcheck SC2016 flags single-quoted strings that look like shell expansions. These are intentional: - run-review.sh: JSON permission config (not shell) - test-pipeline.sh: testing literal string preservation Assisted-by: claude-opus Generated with AI assistance (claude-opus) Signed-off-by: sonupreetam <[email protected]>
Points to dc82f77 (opsx/council-review-sandbox) which adds: - Runtime permission enforcement via OPENCODE_CONFIG_CONTENT (denies bash, edit, webfetch, websearch, skill) - Plugin isolation via --pure flag - Divisor agent migration from tools: to permission: frontmatter - 13 new test assertions (73 total) - Expanded docs (quickstart, architecture, security risk A7) Refs #428, unbound-force/unbound-force#425 Signed-off-by: sonupreetam <[email protected]>
Artifact from previous collect run expired (1-day retention). Fresh collect needed to test runtime sandbox changes from unbound-force/unbound-force#425. Signed-off-by: sonupreetam <[email protected]>
* feat(ci): add production council review workflow chain Three-file workflow chain for AI council review using OpenCode on Vertex AI via ITPC WIF authentication: - ci_council_review_collect.yml (synced): fork-safe diff collection on pull_request, uploads PR diff + metadata as artifact - ci_council_review.yml (synced): thin consumer on workflow_run, calls reusable_council_review.yml with secrets - reusable_council_review.yml (NOT synced): shared review logic — WIF auth, council-review-action composite action, cleanup of previous bot comments, inline comment posting via GitHub API Also fixes the off-by-one truncation bug in generate-crapload-comment.sh where the trailer was appended after the byte limit. Signed-off-by: sonupreetam <[email protected]> * chore: update council-review-action SHA after squash Points to 78c8a65 (single squashed commit on feat/council-review-action). Signed-off-by: sonupreetam <[email protected]> * feat(ci): gate council review on org membership Only run AI review for PRs from org members (MEMBER, OWNER, or COLLABORATOR). External contributors skip at the collect stage, so no WIF tokens are consumed. Uses author_association from the pull_request event — no extra PAT needed. Requested by Trevor and Jason. Signed-off-by: sonupreetam <[email protected]> * chore: update council-review-action SHA for formatting fix Points to eece8d4 (feat/council-review-action-v2) which includes improved inline comment formatting with line breaks between severity header and comment body. Signed-off-by: sonupreetam <[email protected]> * fix(ci): use ORG_CHECK_TOKEN for private org membership checks GITHUB_TOKEN can only check public org membership. Private members (the GitHub default) return 404. Falls back to GITHUB_TOKEN when ORG_CHECK_TOKEN is not configured. Matches the pattern from reusable_publish_ghcr.yml. Signed-off-by: sonupreetam <[email protected]> * fix(ci): add newline after bot marker in inline comments The HTML comment <!-- council-review-bot --> was glued directly to the bold severity header, preventing GitHub's markdown renderer from applying bold formatting in some cases. Signed-off-by: sonupreetam <[email protected]> * fix(ci): address PR #428 review feedback - Gate cleanup step on review success to prevent deleting previous bot comments without replacement on transient failures (HIGH, yvonnedevlinrh) - Use GraphQL variables instead of string interpolation for minimizeComment mutation to eliminate injection risk (HIGH, gxmiranda + yvonnedevlinrh) - Create tracking issue #440 for continue-on-error removal and add issue reference to TODO comment (MEDIUM, gxmiranda) - Add regression tests for crapload comment truncation per TC-006 (MEDIUM, gxmiranda + yvonnedevlinrh) - Surface stderr on inline comment posting failures for diagnostics (LOW, yvonnedevlinrh) Assisted-by: OpenCode (claude-opus-4-6) Signed-off-by: sonupreetam <[email protected]> * fix(ci): suppress SC2016 for intentional GraphQL variable in single quotes The GraphQL query uses $id as a GraphQL variable, not a shell variable. Single quotes are correct here — shellcheck SC2016 is a false positive. Refs #428 Signed-off-by: sonupreetam <[email protected]> * fix(ci): move SC2016 disable to offending line for actionlint The shellcheck disable directive at the top of the run block was not picked up by actionlint's embedded shellcheck. Moving it directly before the line with the single-quoted GraphQL variable fixes the CI failure. Refs #428 Assisted-by: OpenCode (claude-opus-4-6) Signed-off-by: sonupreetam <[email protected]> * fix(ci): defer downstream sync and add provenance headers Address staged rollout concern from review (marcusburghardt): - Add provenance headers to consumer workflows indicating they are managed by org-infra and should not be edited locally (#415) - Exclude all downstream repos from council review sync entries until prerequisites are met: - Composite action SHA on merged main (unbound-force#336) - Security hardening (#429) and cost controls (#430) in place - End-to-end chain validated on org-infra Refs #415, #428, #429, #430 Assisted-by: OpenCode (claude-opus-4-6) Signed-off-by: sonupreetam <[email protected]> * fix: isolate test output via configurable COMMENT_FILE Make COMMENT_FILE configurable via environment variable (defaulting to /tmp/crapload-comment-body.md for backward compatibility). Tests now use isolated temp files per invocation, preventing cross-test interference through the shared /tmp path. Refs #428 Assisted-by: OpenCode (claude-opus-4-6) Signed-off-by: sonupreetam <[email protected]> * chore: update council-review-action SHA to latest #336 Points to 26db3b7 (feat/council-review-action-v2) which includes all review feedback fixes from jflowers and yvonnedevlinrh: - Expression injection fix (github.action_path via env:) - Path traversal validation on agents-pattern - set -euo pipefail restored in run-review.sh - Credential unset before opencode run (GH_TOKEN + GOOGLE_APPLICATION_CREDENTIALS) - File permissions fix (prepare-diff.sh, filter-diff-lines.py) - Spec artifacts updated to reference opencode run - parse-output.sh extracted from action.yml - Size/iteration limits on extract-review-json.py - Pipeline tests wired into CI (26 scenarios, 60 assertions) - Model input validation, timeout wrapper, CHANGELOG Refs #428, unbound-force/unbound-force#336 Signed-off-by: sonupreetam <[email protected]> * docs: add council review documentation to AGENTS.md and ops guide - Add Council Review section to AGENTS.md with workflow chain diagram, required secrets table, sync/rollout status, and related issues - Add docs/COUNCIL_REVIEW.md with full operational guide: architecture diagram, workflow files table, gate conditions, composite action pipeline, rollout plan, manual trigger instructions, bot comment lifecycle, and troubleshooting guide Refs #428 Signed-off-by: sonupreetam <[email protected]> * chore: update council-review-action SHA to 28b8b43 Picks up the GOOGLE_APPLICATION_CREDENTIALS fix (48c9d01): only unset GH_TOKEN before opencode run, keep WIF credential path so Vertex AI authentication works. Also includes security risk A3 trade-off documentation (28b8b43). Refs #428, unbound-force/unbound-force#336 Signed-off-by: sonupreetam <[email protected]> * chore: update council-review-action SHA to test PR #425 Points to dc82f77 (opsx/council-review-sandbox) which adds: - Runtime permission enforcement via OPENCODE_CONFIG_CONTENT (denies bash, edit, webfetch, websearch, skill) - Plugin isolation via --pure flag - Divisor agent migration from tools: to permission: frontmatter - 13 new test assertions (73 total) - Expanded docs (quickstart, architecture, security risk A7) Refs #428, unbound-force/unbound-force#425 Signed-off-by: sonupreetam <[email protected]> * chore: update council-review-action SHA to merged main Points to 7836c07 — the merged main commit from unbound-force/unbound-force#336 (feat: add council-review-action composite GitHub Action). Fulfills the first post-merge checklist item: pin to a stable main SHA now that #336 has landed. Refs #428, unbound-force/unbound-force#336 Signed-off-by: sonupreetam <[email protected]> --------- Signed-off-by: sonupreetam <[email protected]>
|
Hey @sonupreetam. This was a big one so I ran it through an LLM deep dive. Everything seems accurate from my spot checking. Full report below:
1. [HIGH] .opencode/agents/divisor-adversary.md:5Details
2. [HIGH] council-review-action/docs/decisions.md:57Details
3. [HIGH] council-review-action/docs/security-risks.md:128Details
4. [HIGH] council-review-action/scripts/run-review.sh:46Details
5. [HIGH] openspec/changes/council-review-sandbox/design.md:131Details
6. [HIGH] openspec/changes/council-review-sandbox/proposal.md:44Details
7. [HIGH] openspec/changes/council-review-sandbox/specs/council-review-sandbox.md:9Details
8. [MEDIUM] .opencode/agents/divisor-adversary.md:5Details
9. [MEDIUM] .opencode/agents/divisor-curator.md:5Details
10. [MEDIUM] council-review-action/README.md:48Details
11. [MEDIUM] council-review-action/docs/architecture.md:104Details
12. [MEDIUM] council-review-action/docs/decisions.md:63Details
13. [MEDIUM] council-review-action/docs/decisions.md:65Details
14. [MEDIUM] council-review-action/docs/quickstart.md:121Details
15. [MEDIUM] council-review-action/docs/quickstart.md:732Details
16. [MEDIUM] council-review-action/docs/security-risks.md:117Details
17. [MEDIUM] council-review-action/docs/testing.md:70Details
18. [MEDIUM] council-review-action/docs/testing.md:923Details
19. [MEDIUM] council-review-action/scripts/extract-review-json.py:25Details
20. [MEDIUM] council-review-action/scripts/prefetch.sh:64Details
21. [MEDIUM] council-review-action/scripts/run-review.sh:46Details
22. [MEDIUM] council-review-action/test/test-pipeline.shDetails
23. [MEDIUM] council-review-action/test/test-pipeline.shDetails
24. [MEDIUM] openspec/changes/council-review-sandbox/design.md:132Details
25. [MEDIUM] openspec/changes/council-review-sandbox/design.md:166Details
26. [MEDIUM] openspec/changes/council-review-sandbox/proposal.md:44Details
27. [MEDIUM] openspec/changes/council-review-sandbox/specs/council-review-sandbox.md:12Details
28. [MEDIUM] openspec/changes/council-review-sandbox/specs/council-review-sandbox.md:95Details
29. [MEDIUM] openspec/changes/council-review-sandbox/tasks.md:99Details
30. [LOW] .opencode/agents/divisor-adversary.md:5Details
31. [LOW] .opencode/agents/divisor-curator.md:32Details
32. [LOW] council-review-action/docs/architecture.md:71Details
33. [LOW] council-review-action/docs/testing.md:23Details
34. [LOW] council-review-action/docs/testing.md:70Details
35. [LOW] council-review-action/scripts/build-prompt.sh:15Details
36. [LOW] council-review-action/scripts/extract-review-json.py:23Details
37. [LOW] council-review-action/scripts/run-review.sh:22Details
38. [LOW] council-review-action/scripts/run-review.sh:27Details
39. [LOW] council-review-action/scripts/run-review.sh:84Details
40. [LOW] council-review-action/scripts/run-review.sh:88Details
41. [LOW] council-review-action/scripts/run-review.sh:96Details
42. [LOW] council-review-action/scripts/run-review.sh:104Details
43. [LOW] council-review-action/test/test-pipeline.sh:14Details
44. [LOW] council-review-action/test/test-pipeline.sh:371Details
45. [LOW] council-review-action/test/test-pipeline.sh:401Details
46. [LOW] council-review-action/test/test-pipeline.sh:530Details
47. [LOW] council-review-action/test/test-pipeline.sh:631Details
48. [LOW] docs/decisions/001-opencode-over-claude-cli.md:36Details
49. [LOW] internal/scaffold/assets/opencode/agents/divisor-adversary.mdDetails
50. [LOW] internal/scaffold/scaffold_test.go:41Details
51. [LOW] openspec/changes/council-review-sandbox/design.md:135Details
52. [LOW] openspec/changes/council-review-sandbox/specs/council-review-sandbox.md:116Details
53. [LOW] openspec/changes/council-review-sandbox/tasks.md:99Details
|
- Add sandbox config tests (Tests 32-35): Vertex/non-Vertex provider config, MODEL metachar rejection, agent frontmatter permission syntax (18 new assertions, 73->91 total) - Fix assert_contains/assert_not_contains to handle patterns starting with -- (grep end-of-options) - Add timeout 10 to all gh calls in prefetch.sh for parity - Fix quickstart.md to use SHA-pinned ref instead of @main - Clarify quickstart.md agents-pattern scope (mode detection only) - Fix testing.md Test 15 description: no-fix-loop not no-subagent - Clarify design.md D6: edit permission covers write/edit/patch - Clarify proposal.md: list actual deny keys not 'write/execute' - Fix security-risks.md A3: shell-based access not 'all tool paths' - Fix architecture.md: add --pure to auth diagram, rewrite credential claim to reference external_directory and RUNNER_TEMP - Fix decisions.md: clarify edit covers write/edit/patch - Fix run-review.sh: descriptive sandbox label, clarify edit comment, add exit-code-124 comment - Add security rationale comment for quoted heredoc in build-prompt.sh Signed-off-by: sonupreetam <[email protected]>
…tion Signed-off-by: sonupreetam <[email protected]>
|
Thanks @trevor-vaughan for the thorough review. Impressive depth — The
|
| # | Finding | What I did |
|---|---|---|
| 14 | quickstart.md agents-pattern doesn’t affect prompt |
Added caveat that pattern only affects multi/single mode detection |
| 15 | quickstart.md uses @main instead of SHA pin |
Changed to SHA-pinned ref (dc82f77...@main) |
| 16 | security-risks.md A3 overstates "blocks all tool paths" |
Reworded to "blocks shell-based access" and documented the read tool + external_directory: deny + credential file location |
| 17 | testing.md Test 15 says "no-subagent" but that assertion was removed |
Fixed to "no-shell/no-fix-loop constraints" |
| 18 | testing.md says run-review.sh is not locally testable |
Split: config generation is now tested via stub; live denial observation remains integration-only |
| 20 | prefetch.sh inconsistent timeout wrapping |
Added timeout 10 to all 4 remaining gh calls |
| 21-23, 28-29 | run-review.sh sandbox config has zero test coverage | Added Tests 32-35: Vertex config, non-Vertex config, MODEL metachar rejection, agent frontmatter syntax (18 new assertions, 73→91 total) |
| 32 | architecture.md diagram missing --pure |
Added --pure to the auth flow diagram |
| 35 | build-prompt.sh quoted heredoc not explained |
Added comment explaining the security rationale |
| 37 | run-review.sh layer numbering references external nunya#406 |
Changed to descriptive label |
| 38 | run-review.sh "no file writes" comment conflates edit/write |
Clarified that edit covers edit, write, and patch tools per OpenCode docs |
| 41 | run-review.sh exit code 124 unexplained |
Added comment about coreutils timeout sentinel |
Valid findings not addressed (intentional deferral)
| # | Finding | Reason |
|---|---|---|
| 11 | architecture.md credential claim |
Addressed — rewrote to reference external_directory: deny and RUNNER_TEMP |
| 12 | decisions.md deny-list omits external_directory/doom_loop |
The paragraph immediately following explains these. Redundant to repeat in the summary enumeration. |
| 19 | Invalid UTF-8 test for extract-review-json.py |
Valid gap but low priority — errors=replace is a safety net, not a feature. Can address separately. |
| 25 | --pure + multi-agent coexistence not verified in-repo |
Verified via org-infra E2E (complytime/org-infra#427). Adding a local verification would require a live OpenCode install. |
| 44 | Test 14 truncation uses -le 200 not -eq 200 |
Agree the assertion is weak but not a regression risk. Can tighten separately. |
| 45-46 | Temp dir cleanup / test ordering | Agreed, but cleanup-on-error is cosmetic for CI runners. Can address in a follow-up. |
| 47 | Test 27 exit-code-only assertion | Valid but low priority — the test does exercise the code path, just doesn’t inspect stderr. |
| 48 | ADR-001 mentions --command but we use --file |
Pre-existing doc drift, not introduced by this PR. |
| 51 | design.md D6 doesn’t itemize per-agent deny sets |
Can add if the table adds clarity, but the deny sets are already visible in the agent files themselves. |
| 53 | tasks.md 5.5 deferred without org-infra issue ref |
E2E evidence is complytime/org-infra#427, already linked in the PR body. |
Informational findings (no action needed)
| # | Finding | Note |
|---|---|---|
| 9 | Curator bash access now implicit not explicit | Correct — bash defaults to allow in OpenCode. The Curator’s bash restriction section still documents the allowed operations. Intentional. |
| 33 | Assertion/scenario counts verified | Confirmed accurate (now 35/91 after new tests) |
| 50 | Drift test confirms both trees match | Working as intended |
All tests pass: make check (Go) + bash council-review-action/test/test-pipeline.sh (91 assertions, 0 failures).
|
Thanks @sonupreetam, this seems good to me and I appreciate you making the updates. For the items that are deferred, would you mind dropping the ones you think we should do into follow on issues that link back to this one as the source? We might want to think about |
jflowers
left a comment
There was a problem hiding this comment.
/uf.review-pr — PR #425 Review
Verdict: COMMENT
Overall this PR correctly implements a three-layer runtime sandbox for the council-review-action. The implementation is well-documented, backed by 13 new test assertions (60→73), and the security reasoning is sound. Two informational findings below.
Findings
-
[MEDIUM] jq right-side-wins merge semantics in
run-review.shundocumented — see inline comment. -
[LOW] Agent frontmatter omits
websearch: deny— All 9 Divisor agent files (.opencode/agents/divisor-*.md) denyedit,bash, andwebfetchin theirpermission:frontmatter, but do not includewebsearch: deny. The runtimePERMISSION_CONFIGinrun-review.shcorrectly denies all five tools includingwebsearch. This is intentional by design — the spec explicitly limits agent-level denials to those three tools, anddecisions.mddocuments the runtime config as the hard boundary (Layer 1) while agent frontmatter is defense-in-depth (Layer 3). The asymmetry is worth acknowledging in a brief note in the agent frontmatter section ofdecisions.md.
This review was generated by /uf.review-pr (AI-assisted).
- Document jq right-side-wins merge semantics in run-review.sh to prevent future key-collision bugs (Finding 1) - Acknowledge frontmatter deny asymmetry in decisions.md: agent Layer 3 intentionally omits websearch/skill, which are denied only at the runtime Layer 1 (Finding 2) Signed-off-by: sonupreetam <[email protected]>
|
@trevor-vaughan Filed follow-on issues for the deferred items:
Re: finding 48 and the doc drift severity — agreed, this is worth discussing. The constitution's "critical" classification for doc drift doesn't distinguish between "drift introduced by this change" and "pre-existing drift surfaced during review." The LLM reviewer correctly flagged ADR-001 as stale, but it's a pre-existing issue unrelated to this PR. I've noted that distinction in #448 so we can think about whether the severity rules need a "pre-existing" qualifier or whether the reviewer should scope findings to the PR's own changes. Re: @jflowers reviewThanks for the review. Addressed both findings in Finding 1 (MEDIUM) — jq right-side-wins merge semantics: Added a 5-line comment to Finding 2 (LOW) — Agent frontmatter omits Also filed two process issues from the post-mortem on why the review council didn't catch these before submission:
|
Summary
Enforce runtime tool restrictions for the council-review-action,
which processes untrusted PR diff content through an LLM on
Vertex AI. Prior to this change, the only protection was
prompt-level instruction — a soft boundary the model could
ignore via prompt injection.
This change adds three defense-in-depth layers:
OPENCODE_CONFIG_CONTENTenv vardenies bash, edit, webfetch, websearch, and skill at the
OpenCode runtime level (hard enforcement)
--pureflag prevents external MCPplugins from loading
deprecated
tools:topermission:syntaxAdditionally: rewrites the README for clarity, adds quickstart
and architecture docs, expands the security risk register, and
adds 13 new test assertions (60 → 73).
Tracks under complytime/nunya#406 (Review Council Defense in Layers).
Supersedes #337 (closed as not planned — work moved to nunya#406).
Spec: openspec/changes/council-review-sandbox/
E2E evidence: complytime/org-infra#427
How to Test
How to Demo
council-review-action/scripts/run-review.sh— theOPENCODE_CONFIG_CONTENTconstruction at lines 45-56shows the permission denials
.opencode/agents/divisor-*.mdfile withgit diff main -- .opencode/agents/divisor-adversary.mdto see the
tools:→permission:migrationbash council-review-action/test/test-pipeline.shtosee all 31 scenarios pass with 73 assertions
Key Files Changed
council-review-action/scripts/run-review.sh.opencode/agents/divisor-*.md(9 files)internal/scaffold/assets/.../divisor-*.md(9 files)council-review-action/test/test-pipeline.shcouncil-review-action/README.mdcouncil-review-action/docs/architecture.mdcouncil-review-action/docs/quickstart.mdcouncil-review-action/docs/security-risks.mdcouncil-review-action/docs/decisions.mdopenspec/changes/council-review-sandbox/docs/decisions/001-opencode-over-claude-cli.mdCHANGELOG.mdAGENTS.mdThis PR was generated by /finale (AI-assisted).
Closes #426