Skip to content

feat(cycle): enforce per-stage host permissions for native stages - #269

Merged
datacas merged 12 commits into
mainfrom
issue-142-host-permissions
Oct 18, 2026
Merged

datacas merged 12 commits into
mainfrom
issue-142-host-permissions

Conversation

@datacas

@datacas datacas commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Implements B1 of #142: per-stage host permissions for native Claude and Codex dispatches, and an opt-in global set for interactive sessions. B2 is #267.

Closes #142

Summary

  • Claude, GitHub cycles: each stage gets --allowedTools built from its closed command table, plus a PreToolUse hook (scripts/stage_permissions.py). The runtime writes the hook and its policy outside the workspace and TMPDIR. The hook parses every Bash command fail-closed and only ever denies. It refuses:

    • chaining, substitutions, globs, and paths outside the dispatch's own TMPDIR;
    • every force-push spelling, and pushes to the base branch (also when spelled heads/main, or HEAD while on it);
    • gh calls outside the cycle's repository, PR, or work item;
    • gh api, except gh api user --jq .login and resolve's three review-thread GraphQL calls.

    Reviewers can publish only their comment. Docker allows only compose up|down|ps|logs|build, and only under the new Claude docker_host scope.

  • Codex: stages run with --ignore-rules. Reviewers now run in a disposable clone, under a profile whose only writable paths are the clone and TMPDIR. Before a verifying review runs, the runtime proves that confinement with the installed CLI; if it can't, the review stops BLOCKED.

  • Fail-closed preflight: a Claude dispatch stops BLOCKED if any of these could override the hook:

    • disableAllHooks;
    • managed allowManagedHooksOnly;
    • an enabled tool.check mod;
    • a user or project sandbox setting that would widen a review.
  • Verification is configured, not inherited: allowed_commands.test and the new allowed_commands.verify (exact prefixes, validated) are the only verification commands any stage gets. Review and rereview run them only inside their clone. A denied command is listed in the stage report and named in the cycle's stop line, so it can be granted and the cycle resumed with --continue. This repository's .code-cycle.yml now declares both keys.

  • Inactive elsewhere: other code hosts and providers, and Orca workers, keep the earlier behaviour, and each dispatch records command_policy: inactive: ….

  • cc-host-permissions / host_permissions.py:

    • plans, applies, validates, and reverts an opt-in global set that only reads, and denies force-push, merge, and ref deletion;
    • Claude entries are recorded in a registry; the Codex block sits between markers;
    • backs up each file before changing it, and applying twice is a no-op;
    • a hand-edited entry is reported as a conflict, never overwritten.
  • Skills:

    • cc-pr-review runs git merge-base separately (no $(…)) and skips git fetch in a clone without a remote;
    • cc-resolve-comments documents the three exact thread calls.
  • Docs:

    • new docs/host-permissions.md;
    • role-workspace-policy.md, routing.md, configuration.md, and the README updated, including limitations and the migration note;
    • CHANGELOG entry.

Diagnosis

Work units

Unit Behaviour Files Tests Verification Rollback
WU-1 Per-stage command table and hook, Codex --ignore-rules and review clone, Claude review sandbox, preflight, denied-command reporting, allowed_commands.verify, Claude docker_host scope, skill command fixes, docs scripts/stage_permissions.py, executors.py, run_cycle.py, cycle.py, environment_recovery.py, grants.py, runtime.manifest, windows-test-shards.json, .code-cycle.yml, skills/cc-pr-review, skills/cc-resolve-comments, docs/*, README.md, CHANGELOG.md tests/test_stage_permissions.py (55), tests/test_stage_dispatch.py (23), updated test_grants.py, test_environment_recovery.py WU-1 commit alone in a disposable clone: python3 scripts/validate-package.py exit 0; python3 -m unittest discover -s tests exit 0, 1563 tests independent
WU-2 Opt-in global host permissions: cc-host-permissions skill and host_permissions.py scripts/host_permissions.py, skills/cc-host-permissions/SKILL.md, tests/test_host_permissions.py, scripts/validate-package.py, .github/workflows/validate.yml, runtime.manifest, windows-test-shards.json, README.md, docs/README.md, docs/skills.md tests/test_host_permissions.py (18) final tree: validator exit 0; full suite exit 0, 1581 tests dependent on WU-1 (its docs live in WU-1's docs/host-permissions.md). Applying the global set on a machine is reversed with host_permissions.py revert --yes

Verification (agent-reported)

Level Command Exit Executed
static python3 scripts/validate-package.py 0 16 skills valid
test python3 -m unittest discover -s tests 0 1581
test WU-1 commit alone, in a disposable clone: validator and full suite 0 / 0 1563
boundary claude -p (Claude Code 2.1.302) with a permissive allow hook and the stage hook on Bash 0 stage deny prevailed; denial in permission_denials and the tool_result
boundary claude -p with the review sandbox settings 1 refused to start: sandbox required but unavailable … socat not installed (fail-closed path)
boundary CodexAdapter().probe_review_confinement() with Codex CLI 0.163.0 — (True, "…confined writes to the clone and TMPDIR")
boundary codex execpolicy check --rules <generated block> -- … 0 force-push and gh pr merge → forbidden; git status → allow; git push -uf and python3 -c → no rule (documented limitation)

Shared with CI:

  • The tests set their own Git identity, isolate CLAUDE_CONFIG_DIR, CODEX_HOME, and the managed-settings paths, and use fake executors.
  • No real claude or codex binary is needed.

Not shared with CI: the boundary rows above used this machine's installed CLIs. CI doesn't run them.

Residual risk

  • Claude reviews on this host: the Claude Bash sandbox cannot start here because socat/bubblewrap are missing. Once this runtime is installed, a Claude review in a repository with allowed_commands configured (this one included) fails as an environment restriction, and the cycle reroutes or stops. Fix: install bubblewrap and socat.
  • tool.check precedence: checked only from Claude Code's documentation. No tool.check mod was available to test against the installed version; the preflight refuses one by inspection.
  • Not evaluated: sandbox.credentials for limiting a reviewer's credentials.
  • Not verified for Codex: how codex exec reports a refused command, and whether an execpolicy allow escapes the sandbox. Codex denials are therefore not yet named in the stop line.
  • Inherent limits: Codex has no command table; non-Bash tools stay under --allowedTools and the user's configuration.
  • Upgrade impact: a stage that used to run tests through inherited permissions now stops BLOCKED until allowed_commands is configured.

Routing for this stage: profile deep_coder, requested model anthropic/claude-opus-5-5, effort high, resolved model ?.

On a GitHub cycle each native Claude stage now receives only its stage's
command table through --allowedTools, plus a PreToolUse hook the runtime adds
to the dispatch. The hook parses every Bash command fail-closed and denies
anything outside the table: chaining, substitutions, every force-push
spelling, pushes to the base branch, gh api beyond the documented calls, and
paths outside the dispatch's own TMPDIR. Codex stages run with --ignore-rules.

Reviewers verify only inside a disposable clone: Claude under its Bash
sandbox, Codex under a profile the runtime first proves confines writes to
the clone and TMPDIR. A dispatch whose loaded configuration could override
the hook stops BLOCKED, and a denied command is named in the stage report and
the cycle's stop line. allowed_commands.verify adds exact verification
prefixes; docker_host gains a compose-only Claude scope.

Refs #142
host_permissions.py plans, applies, validates and reverts a conservative
global set for interactive Claude and Codex sessions: it allows only reading
and Git queries and denies force-pushes, merges and branch or remote-ref
deletion. It never grants verification, writes, commits, pushes or pull
requests, which stay per stage. It preserves existing hooks, settings and
rules, backs up each file it changes, records the Claude entries it created
outside the repository and marks its Codex block, removes only those on
revert, and reports a hand-edited entry as a conflict instead of touching it.

Refs #142
@datacas

datacas commented Oct 18, 2026

Copy link
Copy Markdown
Owner Author

Initial review — PR #269 (work item #142)

[CCR-20261018-001] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

Verdict: CHANGES_REQUESTED. Reviewed head: e3844b3e92a24b5b308f375251614b40a9f512f2. Blocking findings: REV-001, REV-002.

Summary and scope

I reviewed the full accumulated diff from merge base 7a9512448d239ea080a674a53f9d4fcbcc464fd1 to head e3844b3. It covers 29 files (+4272/−50), from a runtime-supplied diff file of 5084 lines whose SHA-256 matched. The diff adds:

  • a closed command table per stage, with a PreToolUse hook (scripts/stage_permissions.py);
  • argv and preflight wiring for Claude and Codex (executors.py, run_cycle.py, cycle.py);
  • a Claude scope for the docker_host grant;
  • the opt-in global set (host_permissions.py, cc-host-permissions);
  • skill, doc, and test updates.

The hook parser, the checks on push and refspecs, the gh scoping, and the GraphQL thread validation look careful and fail closed. I found no bypass of the stage hook itself. The problems below are in the review sandbox Claude reviewers get, and in the opt-in global set.

Findings

[REV-001] · high · open · - · blocks:yes — Claude's verifying review sandbox gives gh no network, so reviewers cannot read the PR or publish their comment

scripts/stage_permissions.py:1183 (review_sandbox_settings), applied in scripts/executors.py ClaudeAdapter.policy_files.

When allowed_commands.test or allowed_commands.verify is set, review and rereview get requires_confined_verification. Every Bash command then runs inside Claude's sandbox with {"enabled": true, "failIfUnavailable": true, "allowUnsandboxedCommands": false, "filesystem": {...}}. Nothing sets sandbox.network.allowedDomains, and the preflight refuses excludedCommands. Claude Code's sandboxing docs (code.claude.com/docs/en/sandboxing, "Network isolation" and "Hosts outside your allowed domains") say:

  • a sandboxed command has no direct network route;
  • a host outside the allowed domains waits for a decision, which in manual or acceptEdits mode is a prompt.

A claude -p review has nobody to answer that prompt. So gh pr view, gh pr diff, gh pr checks and gh pr comment cannot reach api.github.com from inside the sandbox. The reviewer then cannot read checks or publish the comment its contract requires. This repository's .code-cycle.yml now declares verify, and senior_reviewer's primary target is Claude, so every Claude review of this repo takes this path. The Codex review profile allows the GitHub and Bitbucket domains through its proxy; the Claude one does not. The new tests (test_a_reviewer_that_verifies_runs_in_a_sandboxed_clone, test_the_review_sandbox_writes_only_its_two_paths) check only the filesystem keys, and no test publishes from a sandboxed review.

Evidence: code inspection plus current vendor docs, not observed at runtime. On this host, running claude -p --settings '<review_sandbox_settings output>' with Claude Code 2.1.302 stopped before any tool ran with sandbox required but unavailable … socat not installed. That is the designed environment_restricted path, so a verifying Claude review fails on this host either way. Suggested fix: add network.allowedDomains for the code host, matching Codex's publish allowlist: github.com, api.github.com, and the Bitbucket hosts for symmetry. Add a test that asserts it.

[REV-002] · medium · open · - · blocks:yes — The opt-in global "read-only" set allows git grep, git diff, git log and git show by prefix, which allows running programs and writing files

scripts/host_permissions.py:42-50 (READ_COMMANDS), as rendered in claude_entries() and codex_block().

The skill and the docs say this set "allows only reading and Git queries". But Bash(git grep:*) and the Codex prefix_rule(["git","grep"], allow) also match git grep -O<cmd> and --open-files-in-pager=<cmd>, which run an arbitrary program. Bash(git diff:*), git log:* and git show:* match --output=<path>, which overwrites any file. The stage hook refuses exactly these options (GIT_EXECUTING_OPTIONS, and the --output check limited to $TMPDIR), but the global set applies to every interactive session on the machine and has no such guard. So one prompt injection in any session could run code without a permission prompt.

Evidence (executed): in a scratch repository, git grep -O"touch $D/PWNED" foo created PWNED, and git diff HEAD~0 --output=$D/WRITTEN created WRITTEN. claude_entries()['allow'] contains Bash(git grep:*), Bash(git diff:*), Bash(git log:*) and Bash(git show:*). Suggested fix:

  • drop git grep from the global allow list, or add deny entries for -O, --open-files-in-pager and --output (with the caveat that prefix denies cannot catch every spelling);
  • make the docs state the remaining limit instead of "only reads".

[REV-003] · medium · open · - · blocks:no — A denied docker compose run|exec|… still asks a person for the docker_host grant, which cannot unblock it

scripts/environment_recovery.py:97-120 (denied_docker_blocker).

Any denied command that starts with docker compose becomes the docker_host blocker, including subcommands the hook never allows. check() already tells these cases apart (Decision.needs_docker / _DockerDenied), but the blocker ignores that. The person is then asked to grant access that is root-equivalent on the host. Granting it does not let the command run, and the rerun hits the same denial.

Evidence (executed): denied_docker_blocker(<BLOCKED result>, ['docker compose run --rm app pytest']) returned the docker_host blocker. check('docker compose run --rm app pytest', StagePolicy(role='implement', docker=True)) returned allowed=False, needs_docker=False ("never allowed"). Suggested fix: raise the blocker only for the five grantable subcommands, or for denials where needs_docker is true.

Security triage

  • Deterministic rule: not fired. security_gate.evaluate returned no matched paths, files, or labels with the default rule; .code-cycle.yml declares no security_review.always_when, and the PR has no labels.

  • Reviewer judgement: fired. The change is security tooling: permission enforcement, hooks, sandbox configuration, credential-bearing gh calls, and global host permission files.

  • Security audit: ran inline in this review. The cc-security-review pass was not loaded separately, so this is a degraded pass. It covered:

    • the hook parser: quoting, $TMPDIR expansion, redirections, control characters;
    • push and refspec validation;
    • gh repo, PR and issue scoping;
    • GraphQL thread-call validation and the thread-owner lookup;
    • preflight for disableAllHooks, allowManagedHooksOnly, tool.check mods and sandbox widening;
    • policy-file placement and permissions;
    • the Codex --ignore-rules handling and the review-clone profile;
    • the global set.

    The audit produced REV-002 and REV-003. I found no bypass of the stage hook.

Commands executed

Command Result
wc -l / sha256sum on the supplied diff 5084 lines, f538ceda…2878: matches
python3 scripts/validate-package.py exit 0, VALID: 16 skills (7 cycle, 9 supporting)…
python3 -m unittest discover -s tests exit 0, Ran 1581 tests in 266.410s — OK
claude -p --settings <review_sandbox_settings> (Claude Code 2.1.302) refused to start: sandbox required but unavailable … socat not installed
scratch repo: git grep -O… / git diff --output=… program executed / file written (REV-002)
denied_docker_blocker + check on docker compose run grant blocker raised for a never-allowed command (REV-003)

Unverified

  • REV-001 at runtime: this host's Claude sandbox cannot start because socat is missing, so I could not observe a sandboxed gh call. The finding rests on the code and current Claude Code documentation.
  • codex sandbox --permission-profile probe: probe_review_confinement was exercised only through mocks in the tests. I did not run it against an installed Codex CLI.
  • Hook precedence: I did not run the hook end to end inside a live Claude dispatch. That a hook deny beats another hook's allow, and the RTK rewrite interplay, both come from the PR's own references.

CI (parallel policy: read once, not waited for)

Checks on e3844b3, read with gh pr checks 269 (exit 8):

Check State
Skills, manifests, and Bash installer pending
Windows test shard (windows-1) pending
Windows test shard (windows-2) pending
Windows test shard (windows-3) pending
Windows test shard (windows-4) pending

No check has passed yet. The cycle's CI gate decides on them.

Residual risks

  • When a review runs the configured verification, it executes code from the change under review. The Codex review profile allows GitHub network access, and gh's credentials are readable under :read-only. This was already possible before this PR, but the docs' "reviewers can publish only their comment" holds only for Bash commands an agent types, not for code its test runner executes. Worth a sentence in docs/host-permissions.md.
  • Implementation and resolution stages run the test runner on code they wrote, so the hook does not limit what that code does. This is in line with the documented "writing stages run with the user's credentials" limitation.

- REV-001: give Claude's review sandbox network.allowedDomains for the code
  hosts, matching the Codex review profile, so gh can read and publish.
- REV-002: drop git diff/log/show/grep from the opt-in global allow set;
  their options write files or run programs past a prefix rule. Re-apply
  withdraws entries an earlier version added.
- REV-003: raise the docker_host blocker only for denials the grant lifts.
- CI windows-4: quote literal temp paths in hook tests, since bash (and the
  hook) unescape a Windows path's backslashes otherwise.

Refs #142
@datacas

datacas commented Oct 18, 2026

Copy link
Copy Markdown
Owner Author

Resolution — PR #269 (work item #142)

[CCR-20261018-001] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-001] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:e3844b3e92a24b5b308f375251614b40a9f512f2 · schema:2

Status: RESOLVED. Every finding was triaged against e3844b3 before any edit. The fixes are in 961ba8d and 86cc30d, and the new head is 86cc30dcd9c17b04b435a2d82a2f6ef45810ff53. No blocking finding remains open.

Findings

[REV-001] · high · resolved · valid · blocks:yes — Claude's verifying review sandbox gives gh no network, so reviewers cannot read the PR or publish their comment

scripts/stage_permissions.py (review_sandbox_settings, new REVIEW_SANDBOX_DOMAINS), docs/host-permissions.md.

The sandbox now sets network.allowedDomains to github.com, api.github.com, bitbucket.org and api.bitbucket.org, the same hosts the Codex review profile allows. I confirmed the key name in the installed Claude Code 2.1.302 settings schema: sandbox.network.allowedDomains lists the "Domains sandboxed commands may reach without a prompt". The new test test_the_review_sandbox_reaches_only_the_code_hosts asserts the list and that no other network key is set. The docs now state the limit the review raised as a residual risk: verification code running in the sandbox can also reach these hosts with gh's credentials.
Reservation: I did not observe a sandboxed gh call at runtime. As the review also found, the Claude sandbox cannot start on this host because socat is missing.

[REV-002] · medium · resolved · valid · blocks:yes — The opt-in global "read-only" set allows git grep, git diff, git log and git show by prefix, which allows running programs and writing files

scripts/host_permissions.py, docs/host-permissions.md, skills/cc-host-permissions/SKILL.md, CHANGELOG.md.

I removed all four commands from READ_COMMANDS, for both Claude and Codex. Deny entries would not close the hole: a prefix deny only matches the option in first position, while --output= or -O can come after any argument. The docs and the skill now say why these commands still prompt. apply now also withdraws a managed entry that the current version no longer wants, so re-applying narrows an earlier install. A Codex block is replaced wholesale whenever its hash matches the registry. The new tests are test_no_allowed_prefix_admits_an_option_that_runs_or_writes and test_apply_withdraws_an_entry_this_version_no_longer_wants.

[REV-003] · medium · resolved · valid · blocks:no — A denied docker compose run|exec|… still asks a person for the docker_host grant, which cannot unblock it

scripts/environment_recovery.py (denied_docker_blocker).

The blocker is now raised only when the hook's own check() reports needs_docker, meaning the grant would lift the denial. run, exec, cp, unknown options and redirections outside $TMPDIR no longer enter the grant flow. While reading denials, check() gets a runner that refuses everything, so a denied git push does not start a git subprocess. Executed reproduction: denied_docker_blocker(BLOCKED, ['docker compose run --rm app pytest']) now returns None, and docker compose up -d still returns the docker_host blocker. Tests: the extended test_nothing_else_is_a_docker_blocker and the new test_reading_denials_runs_nothing.

Required check that failed on e3844b3 (separate from the findings)

  • Windows test shard (windows-4) failed, and the cause is in this change. Four subtests passed a literal Windows temp path unquoted (--body-file C:\Users\…\pr-comment.md and --output=C:\…\d.diff). Like bash, the hook parser treats an unquoted backslash as an escape, so the path became C:Usersrunneradmin…. That is not absolute, so the command was denied. The parser is right, because Claude Code runs Bash through Git Bash on Windows; the tests were wrong. The tests now single-quote the literal paths, as an agent must, including the two sibling-path denial cases so that those test containment and not mangling. Reproduced locally: unquoted, the path parses to C:UsersrunneradminAppData…; quoted, it parses unchanged.
  • PowerShell installer failed only at its "Require all Windows test shards to pass" step (exit 1), so it follows from windows-4 and has no cause of its own.

Verification (agent-reported)

Command Result
python3 -m unittest tests.test_stage_permissions tests.test_host_permissions tests.test_stage_dispatch tests.test_environment_recovery tests.test_grants exit 0, 134 tests OK
python3 -m unittest discover -s tests (final head) exit 0, Ran 1585 tests … OK
python3 scripts/validate-package.py exit 0, VALID: 16 skills (7 cycle, 9 supporting)…
Reproductions for REV-001, REV-002 and REV-003, and Windows-path parsing (Python against the scripts) as described above

Environment: Linux (WSL2), Python 3, git 2.34.1. The tests that create commits set their own identity. The Windows path behaviour was reproduced by parsing a Windows-style string on Linux. Whether inside_tmpdir accepts it on a real Windows runner is left to the windows shards.

Post-change review

  • Delta base: e3844b3, the latest trusted review receipt. It is an ancestor of 86cc30d.
  • Fix-delta review: this pass found one problem in my first fix, and I fixed it in 86cc30d. check() on a denied git push would have run git rev-parse in the runtime's working directory.
  • Security triage: fired by judgement, because the change is permission tooling. REV-002 and REV-003 only narrow what is allowed. REV-001 opens four code-host domains to sandboxed review commands, which matches the Codex profile, and that limit is now documented.

Checks of the pushed head (parallel policy: read once, not waited for)

I read the checks once on 86cc30dcd9c17b04b435a2d82a2f6ef45810ff53 right after the push. No check run was registered yet. The six expected checks are pending: Skills, manifests, and Bash installer, Windows test shard (windows-1…4) and PowerShell installer. The cycle's CI gate decides on them.

Residual risks

  • REV-001 is untested at runtime on this host because socat is missing.
  • A user's own sandbox.network.allowedDomains merges into the review sandbox and is not refused by SANDBOX_WIDENING_KEYS. This was not raised in the review and is not changed here.

@datacas

datacas commented Oct 18, 2026

Copy link
Copy Markdown
Owner Author

Rereview — PR #269 (work item #142)

[CCR-20261018-001] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-001] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:e3844b3e92a24b5b308f375251614b40a9f512f2 · schema:2

[CCR-20261018-002] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

Verdict: APPROVED. Reviewed head: 86cc30dcd9c17b04b435a2d82a2f6ef45810ff53 (previous review: e3844b3). No open finding blocks approval, and every required check on this head has passed. One new low, non-blocking finding (REV-004).

What changed since the previous review

Two commits, 961ba8d and 86cc30d, touch 9 files (+113/−17):

  • review_sandbox_settings now sets network.allowedDomains to the four code hosts;
  • READ_COMMANDS no longer contains git diff|log|show|grep, and apply withdraws managed entries the current version no longer wants;
  • denied_docker_blocker now asks check() whether the grant would lift the denial, using a runner that refuses to run anything;
  • the Windows-path tests now quote literal paths;
  • docs, the skill and the CHANGELOG are updated to match.

I rereviewed the full accumulated diff from merge base 7a9512448d239ea080a674a53f9d4fcbcc464fd1, not just the delta. The runtime supplied it as a 5187-line file with SHA-256 d3bc1705…ef32. I confirmed the line count and hash, and it is byte-identical to git diff 7a95124 86cc30d in this clone.

Previous findings

[REV-001] · high · resolved · valid · blocks:yes — Claude's verifying review sandbox gives gh no network, so reviewers cannot read the PR or publish their comment

scripts/stage_permissions.py (REVIEW_SANDBOX_DOMAINS, review_sandbox_settings).

Executed: review_sandbox_settings(("/clone","/tmp/x")) now returns network.allowedDomains = ["github.com","api.github.com","bitbucket.org","api.bitbucket.org"] and no other network key. test_the_review_sandbox_reaches_only_the_code_hosts passes. gh uses only api.github.com for REST and GraphQL, so reading the PR, reading checks and commenting are covered. Unverified at runtime: as before, this host's Claude sandbox cannot start because socat is missing, so I did not observe a sandboxed gh call. I accept the fix on the settings output plus the documented key. If the sandbox still cannot reach the network, a verifying Claude review fails as environment_restricted rather than passing silently.

[REV-002] · medium · resolved · valid · blocks:yes — The opt-in global "read-only" set allows git grep, git diff, git log and git show by prefix, which allows running programs and writing files

scripts/host_permissions.py.

Executed: the Git entries in claude_entries()['allow'] are now only status, rev-parse, branch --show-current, merge-base, ls-files and blame. The ["git", …] prefixes in codex_block() are those same queries plus the deny rules (push, branch, update-ref). No grep, diff, log or show remains. test_apply_withdraws_an_entry_this_version_no_longer_wants covers narrowing an earlier install. The withdrawal touches only registry-owned entries that are still present, so a user's own pre-existing Bash(git grep:*) stays put (it is reported as kept).

[REV-003] · medium · resolved · valid · blocks:no — A denied docker compose run|exec|… still asks a person for the docker_host grant, which cannot unblock it

scripts/environment_recovery.py (denied_docker_blocker).

Executed against a BLOCKED result:

  • docker compose run --rm app pytest → None;
  • git push origin HEAD → None, with nothing run;
  • docker compose up -d, rtk docker compose ps, docker compose -f docker-compose.yml up -d and docker compose logs api 2>&1 → docker_host blocker.

test_reading_denials_runs_nothing confirms that the push rule's git rev-parse reaches the refusing runner and not a subprocess.

New findings

[REV-004] · low · open · - · blocks:no — The docker blocker misses a grantable docker compose command that redirects into $TMPDIR

scripts/environment_recovery.py:114 (ungranted = StagePolicy(role="implement", rtk=True)).

check() tests redirects before the docker rule, and the probe policy has no tmpdir. So a redirect that the granted stage would allow fails the redirect check first, and the result never sets needs_docker. Executed: denied_docker_blocker(BLOCKED, ['docker compose logs > $TMPDIR/l.txt']) returned None. With the dispatch's tmpdir, check() returns needs_docker=True without the grant and allowed=True with it. The effect is a missed grant prompt: the stage stays BLOCKED with a generic reason instead of entering the grant flow. It fails closed. Suggested fix: build the probe policy with the dispatch's tmpdir, or have the caller pass it from the result's artifacts.

Security triage

  • Deterministic rule: not fired. .code-cycle.yml declares no security_review.always_when, the default rule matches no changed path, and the PR has no labels.

  • Reviewer judgement: fired, because the change is permission and sandbox tooling.

  • Audit: ran inline in this rereview. The cc-security-review pass was not loaded separately, so this is a degraded pass. It covered:

    • the new network allowance;
    • the narrowed global set and its withdrawal path;
    • the docker grant flow and the refusing runner;
    • the new module-level from stage_permissions import StagePolicy, check in environment_recovery.py, which has no import cycle and no side effects at import.

    REV-002 and REV-003 only narrow what is allowed. REV-001 opens exactly the four code hosts that the Codex review profile already allows. I found no new vulnerability.

Verification

Command Result
wc -l / sha256sum on the supplied diff, and cmp with git diff 7a95124 86cc30d 5187 lines, d3bc1705…ef32, identical
python3 -m unittest discover -s tests exit 0, Ran 1585 tests in 160.147s — OK
python3 scripts/validate-package.py exit 0, VALID: 16 skills (7 cycle, 9 supporting)…
Reproductions for REV-001, REV-002 and REV-003 (Python against scripts/) as described above
REV-004 probe (denied_docker_blocker and check with and without tmpdir) blocker missed, as described
git status --porcelain after the run clean

Unverified:

  • a live sandboxed gh call (socat is missing on this host);
  • the codex sandbox --permission-profile probe against an installed Codex CLI;
  • the hook end to end inside a live Claude dispatch.

CI (parallel policy: read once, not waited for)

Checks on 86cc30dcd9c17b04b435a2d82a2f6ef45810ff53, read with gh pr checks 269 (exit 0). Workflow run 39139818582 has head_sha 86cc30d, completed, success.

Check Required State
Skills, manifests, and Bash installer yes pass
PowerShell installer yes pass
Windows test shard (windows-1) no pass
Windows test shard (windows-2) no pass
Windows test shard (windows-3) no pass
Windows test shard (windows-4) no pass

The windows-4 failure from e3844b3 no longer reproduces.

Residual risks

  • sandbox_override does not treat sandbox.network.allowedDomains as a widening key, so a user or project setting can add hosts to the review sandbox. The impact is small, because verification code can already use gh's credentials against api.github.com, as docs/host-permissions.md now documents. Adding the key to SANDBOX_WIDENING_KEYS would keep "only the code hosts" literally true.
  • The resolver already noted the remaining risks: verification runs code from the change under review with gh's credentials readable, and the writing stages run with the user's credentials.

…ew sandbox

Claude reviews that may verify run under Claude Code's Bash sandbox, which
on Linux and WSL2 needs bubblewrap and socat. Name both in the requirements,
the host-permissions page, troubleshooting and the changelog, and in the
BLOCKED message an unavailable sandbox produces.
@datacas

datacas commented Oct 18, 2026

Copy link
Copy Markdown
Owner Author

Rereview — PR #269 (work item #142)

[CCR-20261018-001] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-001] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:e3844b3e92a24b5b308f375251614b40a9f512f2 · schema:2

[CCR-20261018-002] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCR-20261018-003] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

Verdict: CHANGES_REQUESTED. Reviewed head: ecb9e4cbc6ce5682e5af1b7b63e064c920a1608f (previous review: 86cc30d). Blocking finding: REV-005 (new). REV-001, REV-002 and REV-003 stay resolved. REV-004 is still open and does not block.

The head moved after the earlier clean rereview, so that approval is not reused. I rereviewed the current head in full, and this pass found a bypass in the stage hook that the earlier passes missed.

What changed since the previous review

One commit, ecb9e4c (6 files, +19/−3), is documentation plus one message string:

  • the README, docs/getting-started.md (requirement and troubleshooting rows), docs/host-permissions.md and the CHANGELOG now say that a verifying Claude review on Linux/WSL2 needs bubblewrap and socat;
  • ClaudeAdapter.environment_restriction names both packages in its BLOCKED detail, and test_stage_dispatch asserts it.

I checked the new doc claims against the installed Claude Code 2.1.302 binary. Its settings schema has sandbox.bwrapPath and sandbox.socatPath, described as "Linux/WSL only" and set "in managed settings". The /sandbox command exists. The claims are accurate.

I rereviewed the full accumulated diff from merge base 7a9512448d239ea080a674a53f9d4fcbcc464fd1, not just the delta. The runtime supplied it as a 5230-line file with SHA-256 859de2e9…6f14. I confirmed the line count and hash, and it is byte-identical to git diff 7a95124 ecb9e4c in this clone. I read the code sections in full: cycle.py, environment_recovery.py, executors.py, grants.py, host_permissions.py, run_cycle.py and stage_permissions.py.

Previous findings

[REV-001] · high · resolved · valid · blocks:yes — Claude's verifying review sandbox gives gh no network, so reviewers cannot read the PR or publish their comment

scripts/stage_permissions.py (REVIEW_SANDBOX_DOMAINS, review_sandbox_settings).

Now verified at runtime for the first time. This host now has bwrap (/usr/local/bin/bwrap) and socat (/usr/bin/socat). I ran claude -p --settings <review_sandbox_settings((clone, tmp))> (Claude Code 2.1.302, failIfUnavailable: true):

  • the sandboxed gh api repos/datacas/code-cycle-toolkit/pulls/269 --jq .head.sha returned ecb9e4cbc6ce5682e5af1b7b63e064c920a1608f;
  • a sandboxed curl https://example.com was refused with deny network-outbound example.com:443 (not in this command's allowed_domains), exit 56.

So the code host is reachable and other hosts are not.

[REV-002] · medium · resolved · valid · blocks:yes — The opt-in global "read-only" set allows git grep, git diff, git log and git show by prefix, which allows running programs and writing files

scripts/host_permissions.py.

Re-executed on ecb9e4c: the Git entries in claude_entries()['allow'] are only status, rev-parse, branch --show-current, merge-base, ls-files and blame, and codex_block() contains no grep, diff, log or show prefix. This file is unchanged since 86cc30d.

[REV-003] · medium · resolved · valid · blocks:no — A denied docker compose run|exec|… still asks a person for the docker_host grant, which cannot unblock it

scripts/environment_recovery.py (denied_docker_blocker).

Re-executed against a BLOCKED result:

  • docker compose run --rm app pytest → None;
  • git push origin HEAD → None;
  • docker compose up -d → docker_host.

[REV-004] · low · open · - · blocks:no — The docker blocker misses a grantable docker compose command that redirects into $TMPDIR

scripts/environment_recovery.py:114.

Still reproducible: denied_docker_blocker(BLOCKED, ['docker compose logs > $TMPDIR/l.txt']) returns None. The code is unchanged and it still fails closed.

New findings

[REV-005] · high · open · - · blocks:yes — The stage hook matches Git's program-running options literally, so git grep -iO<cmd> and git grep --open-files=<cmd> run any program

scripts/stage_permissions.py:430-436 (_check_git, the GIT_EXECUTING_OPTIONS loop), and docs/host-permissions.md:60.

The check refuses a word only when it equals an option, starts with option=, or (for -O) starts with -O. Git's parse-options accepts more than that:

  • Bundled short options. -iO<cmd> or -nO<cmd> parses as -i plus -O<cmd>.
  • Unambiguous long-option prefixes. --open-files=<cmd>, --open-files-in-p=<cmd>, and --upload-pa=<cmd> for fetch and pull.

git grep is in the review, rereview, implement and resolve tables, and Bash(git grep:*) is in their --allowedTools, so neither barrier stops it. A prompt injection in the change under review can therefore run any command from a reviewer. Without allowed_commands, that reviewer runs with no sandbox and with the user's credentials. This defeats the closed table the PR adds. The docs also state that "grep -O [is] refused".

Evidence (executed, git 2.34.1):

  • git grep -iO"touch $D/BUNDLED" foo, git grep -nO"touch $D/NEW" foo, git grep --open-files="touch $D/ABBREV" foo and git grep --open-files-in-p="touch $D/P2" foo each created their file.
  • check() returns allowed=True, "allowed by the stage command table" for the first and third commands under StagePolicy(role="review") and role="rereview". Only the literal git grep -O'x' foo is refused.
  • For writers, git fetch --upload-pa="touch $D/FETCHED; git-upload-pack" origin created FETCHED, and check() allows it under role="resolve". That matters less, because writers already run code they wrote, but the same rule is documented as refused.
  • git diff --outp=… is rejected by git itself (invalid option), so the --output check is not affected.

Suggested fix: refuse any -- word whose name is a prefix of length ≥ 3 of an entry in GIT_EXECUTING_OPTIONS (or of --output). Refuse any single-dash cluster that contains O for grep. Better still, give git grep an option allowlist. Add tests for -iO…, -nO…, --open-files=… and --upload-pa=….

Security triage

  • Deterministic rule: not fired. .code-cycle.yml declares no security_review.always_when, the default rule matches no changed path, and the PR has no labels.

  • Reviewer judgement: fired, because the change is permission, hook and sandbox tooling.

  • Audit: ran inline in this rereview. The cc-security-review pass was not loaded separately, so this is a degraded pass. It covered:

    • the hook parser, the git, gh, docker and GraphQL rules, and find/read-shell;
    • the verify-prefix validation;
    • the sandbox network allowlist, now observed at runtime;
    • the global set;
    • the new environment-restriction message.

    It produced REV-005. I found no other bypass. Git's diff-family options reject abbreviations, and -c/-C and other global options are refused.

Verification

Command Result
wc -l / sha256sum on the supplied diff, and cmp with git diff 7a95124 ecb9e4c 5230 lines, 859de2e9…6f14, identical
python3 -m unittest discover -s tests exit 0, Ran 1585 tests in 159.155s — OK
python3 scripts/validate-package.py exit 0, VALID: 16 skills (7 cycle, 9 supporting), shared sections in sync, cross-agent manifests aligned
sandboxed gh api …/pulls/269 through claude -p --settings <review_sandbox_settings> exit 0, printed the head SHA (REV-001)
sandboxed curl https://example.com with the same settings denied by the sandbox proxy, exit 56
REV-002, REV-003 and REV-004 reproductions (Python against scripts/) as described above
REV-005 scratch repo plus check() probes program executed, and the hook allows it
Claude Code 2.1.302 binary: bwrapPath, socatPath, /sandbox present (the new doc claims hold)
git status --porcelain after the run clean

Unverified:

  • the codex sandbox --permission-profile probe against an installed Codex CLI;
  • the hook end to end inside a full run_cycle Claude dispatch. REV-005 was shown through check(), the function hook_main calls.

CI (parallel policy: read once, not waited for)

Checks on ecb9e4cbc6ce5682e5af1b7b63e064c920a1608f, read with gh pr checks 269 (exit 8), run 39140956154. main has no branch protection; the required checks below are the ones the previous rereview recorded.

Check Required State
Skills, manifests, and Bash installer yes pass
PowerShell installer yes not yet reported (it runs after the shards)
Windows test shard (windows-1) no pass
Windows test shard (windows-2) no pass
Windows test shard (windows-3) no pending
Windows test shard (windows-4) no pending

The cycle's CI gate decides on them.

Residual risks

  • A user or project sandbox.network.allowedDomains still merges into the review sandbox, because it is not in SANDBOX_WIDENING_KEYS. This was noted in the previous rereview and is unchanged.
  • Verification runs code from the change under review, with gh's credentials readable, and the writing stages run with the user's credentials. Both are documented.

…be docker denials with a TMPDIR

REV-005: Git expands unambiguous long-option prefixes and bundles short
options, so git grep -iO<cmd> and --open-files=<cmd> ran any program while
the stage hook allowed them. Refuse every prefix of an executing long
option, any git grep short flag cluster containing O, and abbreviated
--output targets outside TMPDIR.

REV-004: denied_docker_blocker probes with a stand-in TMPDIR, so a
docker compose command redirected into $TMPDIR enters the grant flow.

Refs #142
@datacas

datacas commented Oct 18, 2026

Copy link
Copy Markdown
Owner Author

Resolution — PR #269 (work item #142)

[CCR-20261018-001] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-001] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:e3844b3e92a24b5b308f375251614b40a9f512f2 · schema:2

[CCR-20261018-002] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCR-20261018-003] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-002] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:ecb9e4cbc6ce5682e5af1b7b63e064c920a1608f · schema:2

Status: RESOLVED. New head: 250dddf25812cf585dfa52b31d7e067536943022 (fix commit, previous head ecb9e4c). REV-004 and REV-005 were triaged against ecb9e4c before any edit; both are valid and now resolved. REV-001, REV-002 and REV-003 keep their frozen dispositions and stay resolved; this pass did not touch them.

Applied fixes

[REV-005] · high · resolved · valid · blocks:yes — The stage hook matches Git's program-running options literally, so git grep -iO<cmd> and git grep --open-files=<cmd> run any program

scripts/stage_permissions.py (_check_git, new _names_git_option), docs/host-permissions.md.

  • A long word now counts as an executing option when its name (before =) is a prefix of length > 2 of --upload-pack, --receive-pack, --exec, --exec-path or --open-files-in-pager. That matches how Git expands any unambiguous prefix. The bare -- is excluded.
  • For git grep, any single-dash cluster that contains O is refused (-iO…, -nO…, -inO). The existing -O… refusal stays in place for every subcommand.
  • --output uses the same prefix rule (--outp=…, --ou <path>), so an abbreviated output target outside $TMPDIR is refused too. Git's diff family rejects those abbreviations today, so this only hardens the check.
  • The docs now name the abbreviated and bundled forms.
  • New tests: test_bundled_and_abbreviated_executing_options_are_refused (review, rereview, implement and resolve; also fetch/pull --upload-pa…) and test_ordinary_options_that_share_letters_stay_allowed (-in, --or, --only-matching, --oneline, --output-indicator-new, -S).

[REV-004] · low · resolved · valid · blocks:no — The docker blocker misses a grantable docker compose command that redirects into $TMPDIR

scripts/environment_recovery.py (denied_docker_blocker).

The dispatch's TMPDIR no longer exists when the denial is read. The probe policy therefore gets an empty stand-in TemporaryDirectory, so $TMPDIR/${TMPDIR} redirects pass the redirect rule the way they did in the stage, and the docker rule decides. A redirect to /etc/x still returns None. The refusing runner is unchanged, so nothing runs. New test: test_a_compose_redirected_into_tmpdir_enters_the_grant_flow.

Previous findings (unchanged)

[REV-001] · high · resolved · valid · blocks:yes — Claude's verifying review sandbox gives gh no network, so reviewers cannot read the PR or publish their comment

[REV-002] · medium · resolved · valid · blocks:yes — The opt-in global "read-only" set allows git grep, git diff, git log and git show by prefix, which allows running programs and writing files

[REV-003] · medium · resolved · valid · blocks:no — A denied docker compose run|exec|… still asks a person for the docker_host grant, which cannot unblock it

Verification (agent-reported)

Level Command Result
evidence wc -l and SHA-256 of the supplied accumulated diff 5230 lines, 859de2e9…6f14, matches; PR head was ecb9e4c at triage
reproduction scratch repo, git 2.34.1: git grep -iO"touch …", --open-files="touch …", --op=, --open=, --open-f= each one ran the program (the original finding is real)
reproduction check() probe, old ecb9e4c modules and then new modules: the four REV-005 commands under review and rereview, fetch --upload-pa=… under resolve, and denied_docker_blocker(BLOCKED, ['docker compose logs > $TMPDIR/l.txt']) old: all allowed=True and blocker None. New: all allowed=False and blocker resource=docker_host
security prefix fuzz of every length ≥ 3 of each executing option and of --output, in = and separate-word forms, for grep, fetch, pull, log, diff and show, across 4 roles, plus quoted and bundled -O forms 0 allowed
test python3 -m unittest tests.test_stage_permissions tests.test_stage_dispatch exit 0, Ran 83 tests — OK
test python3 -m unittest discover -s tests exit 0, Ran 1588 tests in 160.814s — OK
static python3 scripts/validate-package.py exit 0, VALID: 16 skills (7 cycle, 9 supporting), shared sections in sync, cross-agent manifests aligned

The tests set their own Git identity and temporary directories. Like CI, the local run does not depend on the global ~/.gitconfig. Unlike CI, it ran on Linux/WSL2 with git 2.34.1 only, not on Windows.

Unverified: the hook end to end inside a full run_cycle Claude dispatch. The fix was exercised through check(), which hook_main calls.

Post-change review

  • Delta base: ecb9e4cbc6ce5682e5af1b7b63e064c920a1608f, the latest trusted rereview receipt. It is confirmed an ancestor of 250dddf, so the post-change review covered only the fix delta (5 files, +81/−27).
  • cc-code-review over the delta: no findings.
  • Security triage: the deterministic rule did not fire (no security_review.always_when, no labels). Resolver judgement fired, because the change is to the permission hook.
  • cc-security-review over the delta: no confirmed vulnerability.

CI (parallel policy: read once, not waited for)

Checks on 250dddf25812cf585dfa52b31d7e067536943022, read once right after the push:

Check State
Skills, manifests, and Bash installer queued
Windows test shard (windows-1) in progress
Windows test shard (windows-2) queued
Windows test shard (windows-3) queued
Windows test shard (windows-4) in progress
PowerShell installer not yet reported (it runs after the shards)

None of these has passed yet. The cycle's CI gate decides on them.

Residual risks

  • git grep now refuses a single-dash cluster with a stuck argument that contains O, such as -eFOO. This fails closed; git grep -e FOO still works.
  • Textconv and external diff drivers still need Git config, which a change under review cannot set, and -c/-C stay refused. The sandbox.network.allowedDomains merge noted in the previous rereview is unchanged.

@datacas

datacas commented Oct 18, 2026

Copy link
Copy Markdown
Owner Author

Rereview — PR #269 (work item #142)

[CCR-20261018-001] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-001] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:e3844b3e92a24b5b308f375251614b40a9f512f2 · schema:2

[CCR-20261018-002] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCR-20261018-003] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-002] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:ecb9e4cbc6ce5682e5af1b7b63e064c920a1608f · schema:2

[CCR-20261018-004] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

Verdict: CHANGES_REQUESTED. Reviewed head: 250dddf25812cf585dfa52b31d7e067536943022 (previous review: ecb9e4c). Blocking finding: REV-006 (new). REV-004 and REV-005 are now resolved and verified by execution. REV-001, REV-002 and REV-003 stay resolved.

What changed since the previous review

One commit, 250dddf (5 files, +81/−27):

  • _check_git now refuses any unambiguous long-option prefix of --upload-pack, --receive-pack, --exec, --exec-path, --open-files-in-pager and --output (new _names_git_option). It also refuses any single-dash git grep cluster that contains O.
  • denied_docker_blocker probes with an empty stand-in TMPDIR, so a > $TMPDIR/… redirect reaches the docker rule.
  • There are new tests for both changes, and the docs now name the abbreviated and bundled forms.

I rereviewed the full accumulated diff from merge base 7a9512448d239ea080a674a53f9d4fcbcc464fd1. The runtime supplied it as a 5284-line file with SHA-256 7aad9c6a…050fec. I confirmed the line count and hash, and cmp shows it is byte-identical to git diff 7a95124 250dddf in this clone. I read the fix delta in full and reread scripts/stage_permissions.py (parser, table, git, push and gh rules) and the Claude argv/policy_files path in scripts/executors.py.

Previous findings

[REV-001] · high · resolved · valid · blocks:yes — Claude's verifying review sandbox gives gh no network, so reviewers cannot read the PR or publish their comment

scripts/stage_permissions.py (REVIEW_SANDBOX_DOMAINS, review_sandbox_settings).

Not touched by the delta. review_sandbox_settings(('/c','/t')) serialises identically on ecb9e4c and 250dddf (same digest), and the domains are still github.com, api.github.com, bitbucket.org and api.bitbucket.org. The runtime check from the previous rereview, a sandboxed gh api call that succeeded and a curl that was denied, therefore still applies.

[REV-002] · medium · resolved · valid · blocks:yes — The opt-in global "read-only" set allows git grep, git diff, git log and git show by prefix, which allows running programs and writing files

scripts/host_permissions.py: unchanged since 86cc30d. Re-executed: the Git entries in claude_entries()['allow'] are only status, rev-parse, branch --show-current, merge-base, ls-files and blame, and codex_block() has no grep, diff, log or show prefix.

[REV-003] · medium · resolved · valid · blocks:no — A denied docker compose run|exec|… still asks a person for the docker_host grant, which cannot unblock it

Re-executed on 250dddf:

  • docker compose run --rm app pytest → None;
  • git push origin HEAD → None;
  • docker compose up -d → docker_host.

[REV-004] · low · resolved · valid · blocks:no — The docker blocker misses a grantable docker compose command that redirects into $TMPDIR

scripts/environment_recovery.py (denied_docker_blocker).

Verified by execution. On ecb9e4c, docker compose logs > $TMPDIR/l.txt returned None. On 250dddf:

  • docker compose logs > $TMPDIR/l.txt and docker compose ps 2> ${TMPDIR}/e.txt → docker_host;
  • docker compose logs > /etc/x and docker compose logs > $TMPDIR/../x → None.

No code-cycle-probe-* directory is left behind.

[REV-005] · high · resolved · valid · blocks:yes — The stage hook matches Git's program-running options literally, so git grep -iO<cmd> and git grep --open-files=<cmd> run any program

scripts/stage_permissions.py (_check_git, _names_git_option).

Verified by execution with an independent probe (git 2.34.1, scratch repo with a bare origin). It covers 112 forms:

  • 18 bundled git grep -<x>O<cmd> clusters;
  • every prefix of --open-files-in-pager, with and without a preceding -i;
  • every prefix of length ≥ 3 of fetch/pull --upload-pack and push --receive-pack/--exec, in both = and separate-word forms;
  • --no-index -iO… and -e foo -O….

Each form went through check() under review, rereview, implement and resolve. Each allowed form was then run with git to see whether the marker program executed.

  • ecb9e4c: 144 cases allowed and executed. This confirms the probe detects the bypass, including git pull --upload-pac=… and git grep --no-index -iO….
  • 250dddf: 0 allowed and executed. Git itself executed 93 of the 112 forms.

Ordinary options still pass: git grep -n|-e|-E|-W|-nI|-l, git log --oneline -n 5, git log --format=%H -1, git diff --stat|--name-only, and git diff --output=$TMPDIR/…. git grep -eFOO and git grep -- -O are refused. That fails closed, as the resolver noted.

New findings

[REV-006] · high · open · - · blocks:yes — A reviewer inherits the user's auto permission mode, edits .git/config with the Edit tool, and an allowed git status then runs any program

scripts/executors.py:2546-2552 (ClaudeAdapter.argv: a non-writing stage under an active command policy gets no --permission-mode), scripts/stage_permissions.py:1033-1038 (hook_settings: matcher Bash only), docs/host-permissions.md:163.

The hook validates only Bash. A reviewer runs with whatever permissions.defaultMode the user configured, because the runtime passes --permission-mode only to writing stages. On this host, ~/.claude/settings.json sets defaultMode: auto. A prompt injection in the change under review can then:

  1. use the Edit tool to add core.fsmonitor = <cmd> (or diff.external) to the review clone's .git/config;
  2. run git status or git diff. The table and the hook allow both (check() returns allowed=True), and Git runs <cmd>.

Without allowed_commands there is no Bash sandbox, so <cmd> runs unconfined with the user's credentials. This is the same outcome as REV-005 through a different door. The PR states that a reviewer can do "nothing else through Bash" (role-workspace-policy.md). The resolver's residual-risk note says "Textconv and external diff drivers still need Git config, which a change under review cannot set". Under auto the agent itself can set it.

Evidence (executed, Claude Code 2.1.302, model haiku, --allowedTools set to exactly allowed_tool_patterns(StagePolicy(role="review", …)), no --permission-mode, as the runtime builds it for a reviewer):

  • The agent appended [core] fsmonitor = touch $S/MARK to .git/config with the Edit tool and reported DONE. A following git status created MARK.
  • With a harmless [ccprobe] marker = 1 edit: inherited mode (auto) gave written=1. Explicit --permission-mode default gave written=0, because the edit was refused.

Suggested fix: when the command policy is active, pass an explicit non-editing mode to every non-writing stage (--permission-mode default, or dontAsk, which denies anything not pre-approved), so the user's defaultMode cannot widen a reviewer. Alternatively, have the preflight stop BLOCKED on an auto, acceptEdits or bypassPermissions default for those stages. As defence in depth, extend the hook matcher to Edit|Write|MultiEdit|NotebookEdit and deny any target inside a .git directory, for every role. Add a test that a review argv carries the explicit mode, and correct the docs' "Non-Bash tools" limitation and the "a change under review cannot set" claim.

Security triage

  • Deterministic rule: not fired. .code-cycle.yml declares no security_review.always_when, the default rule matches no changed path, and the PR has no labels.

  • Reviewer judgement: fired, because the change is the permission hook and its docker-blocker reader.

  • Audit: ran inline in this rereview. cc-security-review was not loaded as a separate pass, so this is a degraded pass. It covered:

    • the new git option rule (independent execution probe above);
    • the stand-in TMPDIR probe (side-effect free, cleaned up);
    • the parser, push, gh and find rules, reread;
    • how non-Bash tools combine with the Git table, which produced REV-006.

    No other bypass was found.

Verification

Command Result
wc -l / sha256sum on the supplied diff, cmp with git diff 7a95124 250dddf 5284 lines, 7aad9c6a…050fec, identical
python3 -m unittest discover -s tests exit 0, Ran 1588 tests in 208.018s — OK
python3 scripts/validate-package.py exit 0
REV-005 execution probe (112 forms × 4 roles), old vs new scripts/ old: 144 allowed and executed; new: 0
REV-004 / REV-003 denied_docker_blocker probes, old vs new as described above
REV-001 review_sandbox_settings digest, ecb9e4c vs 250dddf identical
REV-006 claude -p probes in scratch repos, inherited auto vs --permission-mode default edit applied and git status ran the program / edit refused
git status --porcelain in the review clone after the run clean

Unverified:

  • The hook end to end inside a full run_cycle Claude dispatch. REV-005 and REV-006 were exercised through check() and a standalone claude -p with the same --allowedTools, not through ClaudeAdapter.dispatch.
  • dontAsk as a fix was not probed.
  • No Windows run.

CI (parallel policy: read once, not waited for)

Checks on 250dddf25812cf585dfa52b31d7e067536943022, read once with gh pr checks 269 (exit 8) and statusCheckRollup, run 39142153932. main has no branch protection (gh api …/branches/main/protection → 404); the required checks are the ones earlier rereviews recorded.

Check Required State
Skills, manifests, and Bash installer yes pass (3m10s)
PowerShell installer yes not yet reported (it runs after the shards)
Windows test shard (windows-1) no in progress
Windows test shard (windows-2) no in progress
Windows test shard (windows-3) no in progress
Windows test shard (windows-4) no in progress

The cycle's CI gate decides on them.

Residual risks

  • A user or project sandbox.network.allowedDomains still merges into the review sandbox. This is unchanged from earlier rereviews.
  • Verification runs code from the change under review with gh's credentials readable, and writing stages run with the user's credentials. Both are documented.
  • git grep refuses a stuck single-dash argument that contains O (-eFOO). This fails closed.

…dit tools

A non-writing Claude stage now runs with an explicit --permission-mode
default, so the user's defaultMode (auto, acceptEdits) cannot approve an
edit. The stage hook also matches Edit, Write, MultiEdit and NotebookEdit:
it denies every edit to a non-writing stage and, for every stage, any edit
to a .git directory or file or to Git's global configuration, which an
allowed git status or git diff would otherwise turn into a program run.

Resolves REV-006 on PR #269.
… aliases

An edit denial no longer tells the agent to name a command a person can
grant, because no grant lifts the edit rule. The .git check also matches
the Windows aliases .git., .git and .git::$INDEX_ALLOCATION.
@datacas

datacas commented Oct 18, 2026

Copy link
Copy Markdown
Owner Author

Resolution — PR #269 (work item #142)

[CCR-20261018-001] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-001] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:e3844b3e92a24b5b308f375251614b40a9f512f2 · schema:2

[CCR-20261018-002] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCR-20261018-003] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-002] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:ecb9e4cbc6ce5682e5af1b7b63e064c920a1608f · schema:2

[CCR-20261018-004] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-003] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:250dddf25812cf585dfa52b31d7e067536943022 · schema:2

Status: RESOLVED. New head: 7cc18dc85fa86a4f23a148a59027f37d389f2672 (previous head 250dddf). REV-006 is fixed in c52568e and 7cc18dc and verified by execution, including a live claude -p run. No finding remains open. This is not an approval; a rereview decides.

Triage: the only open finding, REV-006, was classified valid against 250dddf before any edit. The dispositions of REV-001 to REV-005 stay as previously recorded.

Applied fixes

[REV-006] · high · resolved · valid · blocks:yes — A reviewer inherits the user's auto permission mode, edits .git/config with the Edit tool, and an allowed git status then runs any program

scripts/executors.py (ClaudeAdapter.argv), scripts/stage_permissions.py (hook_settings, hook_main, new check_file_edit, FILE_EDIT_TOOLS, EDIT_DENY_ADVICE), docs/host-permissions.md, docs/role-workspace-policy.md.

The fix closes two layers, and each holds on its own:

  1. Explicit mode. Under an active command policy, a non-writing Claude stage now gets --permission-mode default, so the user's defaultMode (auto, acceptEdits) cannot approve an edit. Writing stages keep acceptEdits.
  2. The hook sees the edit tools. The PreToolUse matcher is now Bash|Edit|Write|MultiEdit|NotebookEdit.
    • A non-writing stage (review, rereview, issue_review) is denied every edit.
    • No stage, writing stages included, may edit a path with a .git component (a directory or a worktree's .git file), ~/.gitconfig or $XDG_CONFIG_HOME/git. Paths are checked both literally (after .. normalisation) and after resolving symlinks. The check is case-insensitive and also catches the Windows aliases .git., .git and .git::$INDEX_ALLOCATION.
    • A missing, non-string or relative-without-cwd target is denied.
    • An edit denial says that no grant lifts it, instead of asking for a command to be granted.

Docs: the "Non-Bash tools" limitation now covers only Read and MCP tools, and it says that an MCP server the user allows can still write files. host-permissions.md and role-workspace-policy.md describe the explicit mode and the edit rule.

Tests:

  • HookTests.test_a_non_writing_stage_edits_no_file_with_any_tool: 3 roles × 4 tools × 3 targets.
  • test_no_stage_edits_git_configuration: implement and resolve; denied .git paths and their aliases, a symlink into .git, and global config; allowed src/app.py, .gitignore and .github/ci.yml.
  • test_an_edit_without_a_usable_target_is_denied.
  • The matcher test.
  • The dispatch tests: a reviewer argv carries --permission-mode default and the hook matcher includes Edit; an implementer carries only acceptEdits.

Previous findings (unchanged by this delta)

[REV-001] · high · resolved · valid · blocks:yes — Claude's verifying review sandbox gives gh no network, so reviewers cannot read the PR or publish their comment

[REV-002] · medium · resolved · valid · blocks:yes — The opt-in global "read-only" set allows git grep, git diff, git log and git show by prefix, which allows running programs and writing files

[REV-003] · medium · resolved · valid · blocks:no — A denied docker compose run|exec|… still asks a person for the docker_host grant, which cannot unblock it

[REV-004] · low · resolved · valid · blocks:no — The docker blocker misses a grantable docker compose command that redirects into $TMPDIR

[REV-005] · high · resolved · valid · blocks:yes — The stage hook matches Git's program-running options literally, so git grep -iO<cmd> and git grep --open-files=<cmd> run any program

None of these was debated or rejected.

Verification (agent-reported)

Level Command Result
test python3 -m unittest tests.test_stage_permissions tests.test_stage_dispatch tests.test_executors tests.test_host_permissions exit 0, 290 tests OK (on c52568e)
test python3 -m unittest discover -s tests exit 0, Ran 1591 tests in 210.091s — OK (on the final tree, 7cc18dc)
static python3 scripts/validate-package.py exit 0, VALID: 16 skills …
boundary Live claude -p (Claude Code 2.1.302, model haiku) in a scratch repository. The argv and --settings were built by ClaudeAdapter.argv + policy_files for a review policy, and the agent was asked to append to .git/config with the Edit tool. The host's defaultMode is auto. 250dddf shape (no mode, Bash matcher): written. Fixed: --permission-mode default, not written, hook denial in stream. Hook only (mode removed): not written, hook denial in stream.

An earlier full run on c52568e failed 2 test_validate_package tests. The cause was this stage's scratch files under .local/, which tripped the private-data scan. The files were moved out of the worktree; the module and then the full suite passed.

Environment shared with CI: plain python3 -m unittest, no user-global Git identity used by the new tests. Not shared: the live claude -p probe, which needs an authenticated Claude CLI, and Windows (the alias and symlink cases are written to pass or skip there but did not run on Windows locally).

Post-change review

  • Fix delta: cc-code-review over 250dddf..c52568e. 250dddf is an ancestor of the new head and comes from the latest trusted rereview receipt. No P0, P1 or P2. One P3 was fixed in 7cc18dc: edit denials reused the advice to "name the exact command so a person can grant it once", but no grant exists for an edit.
  • Security triage:
    • The deterministic rule did not fire: no security_review.always_when, no PR labels.
    • Reviewer judgement fired, because the change is the permission hook.
    • An inline audit (a degraded pass, not a separate cc-security-review run) covered: symlinks and .., case, Windows short and stream aliases (hardened in 7cc18dc), hard links (no ln in any table), relative targets, MCP tools (documented limitation), and the hook's denial being invisible to the permission_denials report (correct: no grant applies).

Checks of the pushed head (parallel policy: read once, not waited for)

The checks were read once on 7cc18dc85fa86a4f23a148a59027f37d389f2672 with gh pr view 269 --json headRefOid,statusCheckRollup. The head matched, and the rollup was empty: the workflow run had not registered yet. The expected checks are therefore all pending and none has a result: Skills, manifests, and Bash installer; PowerShell installer; Windows test shards 1–4. The cycle's CI gate decides on them.

Residual risks

  • An MCP server that the user's configuration allows can still write files, .git/config included. The hook covers Bash and Claude's four edit tools only. This is documented.
  • Reviewers can no longer create scratch files with the edit tools. Their execution evidence must come from the configured verification commands.
  • A user or project sandbox.network.allowedDomains still merges into the review sandbox. This is unchanged from earlier rereviews.

@datacas

datacas commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner Author

Rereview — PR #269 (work item #142)

[CCR-20261018-001] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-001] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:e3844b3e92a24b5b308f375251614b40a9f512f2 · schema:2

[CCR-20261018-002] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCR-20261018-003] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-002] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:ecb9e4cbc6ce5682e5af1b7b63e064c920a1608f · schema:2

[CCR-20261018-004] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-003] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:250dddf25812cf585dfa52b31d7e067536943022 · schema:2

[CCR-20261018-005] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

Verdict: CHANGES_REQUESTED. Reviewed head: 7cc18dc85fa86a4f23a148a59027f37d389f2672 (previous review: 250dddf). Blocking finding: REV-007 (new). REV-006 is resolved, and a live run verified it. REV-001 to REV-005 stay resolved.

What changed since the previous review

Two commits, c52568e and 7cc18dc (6 files, +146/−11):

  • ClaudeAdapter.argv passes --permission-mode default to a non-writing stage under an active command policy.
  • The hook matcher is now Bash|Edit|Write|MultiEdit|NotebookEdit. The new check_file_edit denies every edit for non-writing roles. For writing roles it denies any .git component (including case and Windows aliases), ~/.gitconfig and $XDG_CONFIG_HOME/git, checking both the literal and the resolved path.
  • Edit denials carry their own advice (EDIT_DENY_ADVICE).
  • There are new tests, and the docs were updated.

I rereviewed the accumulated diff from merge base 7a9512448d239ea080a674a53f9d4fcbcc464fd1:

  • The runtime supplied it as a 5419-line file with SHA-256 e6959996…79de. I confirmed the line count and hash.
  • cmp shows the file is byte-identical to git diff 7a95124 7cc18dc in this clone.
  • The GitHub compare API reports main 0 behind with the same merge base.

I read the fix delta (275 lines) in full. I reread ClaudeAdapter.argv/policy_files, review_sandbox_settings and the reviewer's redirect and --output handling. The rest of the accumulated diff is unchanged since 250dddf, which the previous rereview covered.

Previous findings

[REV-001] · high · resolved · valid · blocks:yes — Claude's verifying review sandbox gives gh no network, so reviewers cannot read the PR or publish their comment

scripts/stage_permissions.py (review_sandbox_settings): not touched by the delta. It still sets allowUnsandboxedCommands: false, failIfUnavailable: true and the four code-host domains.

[REV-002] · medium · resolved · valid · blocks:yes — The opt-in global "read-only" set allows git grep, git diff, git log and git show by prefix, which allows running programs and writing files

scripts/host_permissions.py: unchanged by the delta. The full suite, including tests.test_host_permissions, passes.

[REV-003] · medium · resolved · valid · blocks:no — A denied docker compose run|exec|… still asks a person for the docker_host grant, which cannot unblock it

Unchanged by the delta (scripts/environment_recovery.py not touched). Its tests pass.

[REV-004] · low · resolved · valid · blocks:no — The docker blocker misses a grantable docker compose command that redirects into $TMPDIR

Unchanged by the delta. Its tests pass.

[REV-005] · high · resolved · valid · blocks:yes — The stage hook matches Git's program-running options literally, so git grep -iO<cmd> and git grep --open-files=<cmd> run any program

_check_git/_names_git_option: unchanged by the delta. Its tests pass.

[REV-006] · high · resolved · valid · blocks:yes — A reviewer inherits the user's auto permission mode, edits .git/config with the Edit tool, and an allowed git status then runs any program

scripts/executors.py (ClaudeAdapter.argv), scripts/stage_permissions.py (check_file_edit, hook_settings, hook_main).

I verified this with a live run on this host: Claude Code 2.1.302, defaultMode: auto, model haiku. Each run used a scratch repository with a rereview policy that has allowed_commands. Its --settings came from hook_settings + review_sandbox_settings, and its --allowedTools came from allowed_tool_patterns, built the same way policy_files builds them. In each run the agent was asked to append [ccprobe] to .git/config with the Edit tool.

  • Fixed shape (--permission-mode default + new matcher): the edit was refused, with PreToolUse:Edit hook error: code-cycle rereview stage policy denied this command: a rereview stage edits no file. No grant lifts this rule…. .git/config was unchanged.
  • Hook layer alone (no --permission-mode, so auto is inherited): the same hook denial appeared, and .git/config was unchanged. The two layers hold independently.

I also ran the reviewer's Bash write paths into .git through check(). All were refused:

  • >, >> and 1> redirects to .git/config;
  • $TMPDIR/../…;
  • git diff/log --output=.git/config;
  • | tee, >| and &>;
  • gh api -o;
  • gh run download -D.

git status stays allowed. A sandboxed verification command cannot escape either, because allowUnsandboxedCommands is false.

New findings

[REV-007] · high · open · - · blocks:yes — A reviewer can run any program through an MCP tool that the user's global configuration pre-approves; neither the hook nor the explicit mode nor the sandbox covers it

scripts/stage_permissions.py:1081-1086 (hook_settings: matcher is Bash|Edit|Write|MultiEdit|NotebookEdit), scripts/stage_permissions.py:1290-1294 (hook_main returns 0 for any other tool), scripts/executors.py:2548-2557, docs/host-permissions.md:172-175.

A cycle stage keeps the user's global configuration on purpose, so that the RTK hooks still load. That configuration includes permissions.allow. On this host it pre-approves mcp__plugin_context-mode_context-mode__ctx_execute and ctx_batch_execute, which run arbitrary shell code in the MCP server's process. Three protections are on the dispatch, and none of them covers that tool:

  • The hook matcher does not match mcp__*, so the hook never sees the call.
  • --permission-mode default does not ask, because the tool is pre-approved.
  • The Bash sandbox does not confine it, because the command runs in the MCP server's process, not through Bash.

So a prompt injection in the change under review can make the reviewer run git push, gh pr merge, or any program, with the user's credentials. That is the outcome REV-005 and REV-006 closed, through another door. It contradicts work item #142: in Claude the isolation must not be bypassed "mediante permisos globales", and "un reviewer no puede ejecutar git push ni escrituras gh distintas de publicar su comentario". It also contradicts role-workspace-policy.md, which says a reviewer can do "nothing else through Bash" and that the user's defaultMode cannot let it rewrite .git/config. The docs' limitation says an allowed MCP server "can still write files". That understates the problem: the server can run programs, and the default configuration of the host that runs this cycle allows one.

Evidence (executed). Same live harness as REV-006: fixed shape, rereview role, --permission-mode default, sandbox settings applied. The agent was asked to call ctx_execute with touch <marks>/mcp_mark && git -C <clone> config ccprobe.marker 1.

  • The tool ran and returned ok, and permission_denials was [].
  • mcp_mark was created in a directory outside both the clone and the dispatch TMPDIR.
  • .git/config gained ccprobe.marker, even though git config is not in the rereview table.

Suggested fix: make the hook see MCP tools. Extend the matcher to include mcp__.*, and have hook_main deny every MCP tool for non-writing stages. For writing stages, deny MCP tools too, or allow only an explicit read-only list. Without that, an MCP tool can run git push --force or push to the base branch outside the table. Alternatively, or in addition, have the preflight stop BLOCKED when the loaded configuration pre-approves any mcp__* tool for a policy-bound stage, naming the entry. Add a hook test for an mcp__… event per role, and a matcher test. Then correct the docs' MCP limitation.

Security triage

  • Deterministic rule: not fired. .code-cycle.yml declares no security_review.always_when, the default rule matches no changed path, and the PR has no labels.

  • Reviewer judgement: fired, because the delta changes the permission hook and the Claude dispatch mode.

  • Audit: ran inline in this rereview. cc-security-review was not loaded as a separate pass, so this is a degraded pass. It covered:

    • check_file_edit (literal and resolved paths, case, Windows aliases, relative targets without cwd, non-string targets);
    • the reviewer's Bash write paths into .git;
    • the explicit mode;
    • the review sandbox's allowUnsandboxedCommands: false;
    • which non-Bash tools the user's configuration pre-approves. This last check produced REV-007.

    For reviewers, edit-tool targets are denied outright, so path aliasing cannot matter there. For writing stages, the .git rule is defence in depth: they already run python3 -m unittest unsandboxed.

Verification

Command Result
wc -l / sha256sum on the supplied diff, cmp with git diff 7a95124 7cc18dc 5419 lines, e6959996…79de, identical
python3 -m unittest discover -s tests exit 0, Ran 1591 tests in 200.049s — OK
python3 scripts/validate-package.py exit 0, VALID: 16 skills (7 cycle, 9 supporting)…
check() probe: 18 reviewer write paths into .git all refused; git status allowed
Live claude -p, Edit of .git/config, fixed shape hook denial, file unchanged
Live claude -p, Edit of .git/config, hook only (inherited auto) hook denial, file unchanged
Live claude -p, ctx_execute shell, fixed shape executed: mark outside the sandbox, git config written, no denial
git status --porcelain in the review clone after the run clean

Unverified:

  • The full ClaudeAdapter.dispatch path. The live probes rebuilt argv/--settings from the same functions, but not through dispatch.
  • No Windows run of the alias and symlink cases; the CI Windows shards cover the unit tests.
  • I did not probe whether --strict-mcp-config removes plugin-provided MCP servers.

CI (parallel policy: read once, not waited for)

Checks on 7cc18dc85fa86a4f23a148a59027f37d389f2672, read once with gh pr checks 269 (exit 8), run 39143991829. The required checks are the ones earlier rereviews recorded.

Check Required State
Skills, manifests, and Bash installer yes pass (3m7s)
PowerShell installer yes not yet reported (runs after the shards)
Windows test shard (windows-1) no pass (4m56s)
Windows test shard (windows-2) no pass (3m32s)
Windows test shard (windows-3) no pending
Windows test shard (windows-4) no pass (4m20s)

The cycle's CI gate decides on them.

Residual risks

  • A user or project sandbox.network.allowedDomains still merges into the review sandbox. This is unchanged from earlier rereviews.
  • Verification runs code from the change under review with gh's credentials readable, and writing stages run with the user's credentials. Both are documented.
  • Reviewers can no longer create scratch files with the edit tools, so their evidence must come from the configured verification commands. That is intended.
ORCHESTRATION_RESULT (JSON)

ORCHESTRATION_RESULT
{"skill":"cc-rereview","status":"CHANGES_REQUESTED","issue_provider":"github","issue_id":"142","code_host":"github","change_request_id":"269","change_request_url":"https://github.com/datacas/code-cycle-toolkit/pull/269","pr_number":269,"issue_number":142,"comment_url":"https://github.com/datacas/code-cycle-toolkit/pull/269#issuecomment-6252236478","previous_reviewed_head_sha":"250dddf25812cf585dfa52b31d7e067536943022","reviewed_head_sha":"7cc18dc85fa86a4f23a148a59027f37d389f2672","head_sha":"7cc18dc85fa86a4f23a148a59027f37d389f2672","review_run_id":"CCR-20261018-005","reviewer":{"profile":"senior_reviewer","provider":"anthropic","model_requested":"anthropic/claude-opus-5-5","model_resolved":null,"effort":"high"},"verified_findings":[{"id":"REV-001","severity":"high","blocks_approval":true,"status":"resolved","disposition":"valid"},{"id":"REV-002","severity":"medium","blocks_approval":true,"status":"resolved","disposition":"valid"},{"id":"REV-003","severity":"medium","blocks_approval":false,"status":"resolved","disposition":"valid"},{"id":"REV-004","severity":"low","blocks_approval":false,"status":"resolved","disposition":"valid"},{"id":"REV-005","severity":"high","blocks_approval":true,"status":"resolved","disposition":"valid"},{"id":"REV-006","severity":"high","blocks_approval":true,"status":"resolved","disposition":"valid"}],"new_findings":[{"id":"REV-007","severity":"high","status":"open","disposition":"-","blocks_approval":true,"path":"scripts/stage_permissions.py","line":1081}],"blocking_findings":["REV-007"],"checks":{"head_sha":"7cc18dc85fa86a4f23a148a59027f37d389f2672","passed":4,"failed":0,"pending":2},"blocking":false}
END_ORCHESTRATION_RESULT

@datacas

datacas commented Oct 18, 2026

Copy link
Copy Markdown
Owner Author

Owner decision on REV-007 (non-Bash tools pre-approved by the user's configuration)

REV-007 is accepted as a documented limitation, not something the stage blocks. The stage table and hook govern the cycle's Bash commands; MCP servers, plugins and other non-Bash tools stay governed by the user's own configuration. We cannot know in advance which tools a user installs, so an allow list of tools is not viable and is out of scope. Please publish REV-007 as not_applicable with this decision as the reason.

Instead of blocking, the cycle informs. Implement in this PR:

  1. Notice, never a stop. For a policy-bound Claude stage (review and rereview at least; all of them if it is no harder), read the configuration the dispatch already loads and list the non-Bash tools the user has pre-approved (permissions.allow entries such as mcp__*, and an auto/bypassPermissions mode if present). Report them once in the dispatch report or stop line, e.g. "outside the stage table: pre-approved by your configuration: mcp__plugin_context-mode__ctx_execute, …". The stage keeps running. No new BLOCKED path, no new question.
  2. Proportionate wording. No alarmist language. Say what the table covers and what it does not, and flag a tool as worth a thought only when it can run arbitrary code or write files (for example a code-execution MCP tool) and the cycle runs unattended. A read-only tool (documentation lookup, symbol search) needs no warning.
  3. Docs. In docs/host-permissions.md (and the Limitations section of the changelog entry), state plainly: what the stage table protects (the cycle's own Bash commands: no force-push, merge, branch deletion, reviewer writes), what it does not (non-Bash tools the user approved), why that is reasonable in supervised use, and when to reconsider (code-running tools pre-approved for unattended runs). This is not a sandbox against hostile code, and the docs should not imply it is.
  4. Tests for the detection and for the notice: it lists pre-approved non-Bash tools, says nothing when there are none, and never changes the stage outcome.

REV-005 and REV-006 stay as fixed: they close specific Git and .git/config paths inside what B1 promises, and are not tool allow lists.

… stage table

The owner accepted REV-007 as a documented limitation: the stage table and
hook govern the cycle's Bash commands and file edits, and MCP, plugin and
other non-Bash tools stay under the user's own configuration. A Claude stage
on a GitHub cycle now reads the configuration its dispatch loads and the
cycle reports those tools once in the stage report, flagging the ones whose
names suggest they run code or write files. It never stops the stage.

Refs #142
@datacas

datacas commented Oct 18, 2026

Copy link
Copy Markdown
Owner Author

Resolution — PR #269 (work item #142)

[CCR-20261018-001] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-001] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:e3844b3e92a24b5b308f375251614b40a9f512f2 · schema:2

[CCR-20261018-002] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCR-20261018-003] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-002] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:ecb9e4cbc6ce5682e5af1b7b63e064c920a1608f · schema:2

[CCR-20261018-004] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-003] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:250dddf25812cf585dfa52b31d7e067536943022 · schema:2

[CCR-20261018-005] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-004] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:7cc18dc85fa86a4f23a148a59027f37d389f2672 · schema:2

Status: RESOLVED. New head: 31165bbaf14db5ebfb2361b172ffc999b142bf2e (previous: 7cc18dc). All findings were triaged against 7cc18dc before any edit.

Findings

[REV-007] · high · not_applicable · debatable · blocks:yes — A reviewer can run any program through an MCP tool that the user's global configuration pre-approves; neither the hook nor the explicit mode nor the sandbox covers it

Disposition debatable: the reviewer's live reproduction is real. Whether the stage must stop for it is a scope decision, and the owner made it in this comment. It is accepted as a documented limitation. The stage table and hook govern the cycle's Bash commands and file edits. MCP, plugin and other non-Bash tools stay under the user's own configuration, and no tool allow list is kept. Anchored to 7cc18dc.

The cycle now informs instead, as the owner asked (880b0db, 31165bb):

  • Notice, never a stop. stage_permissions.preapproved_outside_table reads the configuration a policy-bound Claude dispatch loads: managed settings, the user's settings.json, and the workspace's .claude/settings.json and settings.local.json. It lists the permissions.allow tools the table does not account for. Bash, the hooked edit tools, Task/Agent and Claude's read-only built-ins are left out. ClaudeAdapter.policy_notice puts that list in the dispatch artifacts as preapproved_tools, for every role on a GitHub cycle. run_cycle reports it once per run as a stage-report warning. The notice adds no BLOCKED path and no question. An unreadable settings layer is skipped, and any error in the notice is swallowed.
  • Proportionate wording. outside the stage table, pre-approved by your configuration: … (the table governs this cycle's Bash commands and file edits). Only a tool whose name suggests it runs code or writes files (execute, run, shell, write, …) gets …can run code or write files, worth a thought when the cycle runs unattended. A read-only tool is listed without a flag.
  • The permission mode. The owner asked about an auto or bypassPermissions mode. A user or project defaultMode is not named, because a policy-bound dispatch always passes its own --permission-mode (default for reviewers, acceptEdits for writers), so that setting does not apply. A managed defaultMode of auto or bypassPermissions is named.
  • Docs. docs/host-permissions.md has a new section, What the table covers, and what it does not. It also has a rewritten Limitations bullet, and a line in role-workspace-policy.md. The [Unreleased] changelog entry has no Limitations section, so I added a Limitation bullet under Changed. These state that the table is not a sandbox against hostile code.
  • Tests. Detection: lists MCP tools across layers, deduplicates, ignores covered tools, ignores a non-list allow, skips an unreadable layer, and names a managed mode but not a user one. Wording: a read-only tool gets no flag, and execute tools get one. Dispatch: the artifact appears for rereview and implement and is absent with no entries or an inactive policy, and the outcome, error code and lifecycle are unchanged. Cycle: the notice appears in exactly one stage report across the run, and the status, stop reason and stage sequence match a run without it.

On this host, the real configuration produces:

outside the stage table, pre-approved by your configuration: mcp__plugin_context-mode_context-mode__ctx_execute, mcp__plugin_context-mode_context-mode__ctx_batch_execute, mcp__plugin_context-mode_context-mode__ctx_search (…); mcp__plugin_context-mode_context-mode__ctx_execute, mcp__plugin_context-mode_context-mode__ctx_batch_execute can run code or write files, worth a thought when the cycle runs unattended

That names exactly the two tools REV-007 used. ctx_search is listed without a flag.

[REV-001] · high · resolved · valid · blocks:yes — Claude's verifying review sandbox gives gh no network, so reviewers cannot read the PR or publish their comment

Unchanged; the delta does not touch review_sandbox_settings.

[REV-002] · medium · resolved · valid · blocks:yes — The opt-in global "read-only" set allows git grep, git diff, git log and git show by prefix, which allows running programs and writing files

Unchanged.

[REV-003] · medium · resolved · valid · blocks:no — A denied docker compose run|exec|… still asks a person for the docker_host grant, which cannot unblock it

Unchanged.

[REV-004] · low · resolved · valid · blocks:no — The docker blocker misses a grantable docker compose command that redirects into $TMPDIR

Unchanged.

[REV-005] · high · resolved · valid · blocks:yes — The stage hook matches Git's program-running options literally, so git grep -iO<cmd> and git grep --open-files=<cmd> run any program

Unchanged, as the owner directed.

[REV-006] · high · resolved · valid · blocks:yes — A reviewer inherits the user's auto permission mode, edits .git/config with the Edit tool, and an allowed git status then runs any program

Unchanged, as the owner directed.

Post-change review

  • Delta base: 7cc18dc85fa86a4f23a148a59027f37d389f2672, from the latest trusted rereview receipt. git merge-base --is-ancestor confirms it is an ancestor of the new head. Delta: 8 files, +250/−7.
  • Code review: inline over the fix delta, not delegated. It found one defect, fixed in 31165bb with a regression test: a permissions.allow given as a string would have been iterated character by character.
  • Security triage: the deterministic rule did not fire (security_review.always_when is not declared and the PR has no labels). By judgement it fired, because the delta touches the permission layer. The audit ran inline, not as a separate cc-security-review pass, so it is a degraded pass. The change only reads settings files, grants nothing, and adds no stop. Tool names reach the report through readable() with backticks replaced.

Verification (agent-reported)

Command Result
python3 -m unittest discover -s tests (at 880b0db) exit 0, Ran 1595 tests in 290.090s — OK
python3 -m unittest tests.test_stage_permissions tests.test_stage_dispatch tests.test_run_cycle tests.test_cycle (at 31165bb) exit 0, Ran 363 tests in 157.320s — OK
python3 scripts/validate-package.py (at 31165bb) exit 0, VALID: 16 skills (7 cycle, 9 supporting)…
preapproved_outside_table + preapproved_notice on this host's real configuration 3 tools listed, the two ctx_*execute tools flagged

The local runs share these with CI: Python and the stdlib-only test suite, with Claude settings isolated by CLAUDE_CONFIG_DIR and a patched managed path. They do not share the Windows shards. No live claude -p dispatch was run for the notice. It is a reporting path, and the unit and cycle tests cover how it reaches the report.

CI (parallel policy: read once, not waited for)

Checks on 31165bbaf14db5ebfb2361b172ffc999b142bf2e, read once:

Check State
Skills, manifests, and Bash installer queued
Windows test shard (windows-1…4) queued
PowerShell installer not yet reported (runs after the shards)

The cycle's CI gate decides on them.

Residual risks

  • A pre-approved code-running MCP tool can still do anything the user can during a stage. It is now named, not prevented, by owner decision.
  • The code-running flag reads the tool's name only; a tool with a neutral name that runs code gets no flag.
  • A user or project sandbox.network.allowedDomains still merges into the review sandbox. This is unchanged.

@datacas

datacas commented Oct 18, 2026

Copy link
Copy Markdown
Owner Author

Rereview — PR #269 (work item #142)

[CCR-20261018-001] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-001] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:e3844b3e92a24b5b308f375251614b40a9f512f2 · schema:2

[CCR-20261018-002] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCR-20261018-003] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-002] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:ecb9e4cbc6ce5682e5af1b7b63e064c920a1608f · schema:2

[CCR-20261018-004] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-003] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:250dddf25812cf585dfa52b31d7e067536943022 · schema:2

[CCR-20261018-005] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-004] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:7cc18dc85fa86a4f23a148a59027f37d389f2672 · schema:2

[CCR-20261018-006] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

Status: REVIEW_PASSED_AWAITING_CI. I reviewed the current head 31165bbaf14db5ebfb2361b172ffc999b142bf2e in full and found no open finding that blocks approval. This is not an approval: some required checks are still running, and the cycle's CI gate decides on them.

What changed since the previous review

The previous rereview (CCR-20261018-005) was at 7cc18dc. Since then there are two commits, 880b0db and 31165bb: 8 files, +250/−6. They implement the owner's decision on REV-007 (comment):

  • stage_permissions.preapproved_outside_table, may_run_code and preapproved_notice are new.
  • ClaudeAdapter.policy_notice puts the list into the dispatch artifacts as preapproved_tools.
  • run_cycle reports the notice once per run as a stage-report warning.
  • Docs, the changelog and tests are updated.

Evidence reviewed

  • I read the accumulated diff origin/main...31165bb (merge base 7a95124) from the runtime's evidence file in sections. I confirmed its size (5670 lines) and that its SHA-256 matches the one supplied (870725ee…685eb6). I also read the delta 7cc18dc..31165bb in full.
  • The prior state comes from the 10 PR comments, all by datacas, who is in review.trusted_authors. REV-001…REV-007 were recovered with no ID collision.

Findings

[REV-008] · low · open · - · blocks:no — A server-wide MCP approval (mcp__<server> or mcp__<server>__*) is listed without the code-running flag

scripts/stage_permissions.py:1292 (may_run_code). The function judges only the segment after the last __. Claude Code's permission rules say that mcp__puppeteer and mcp__puppeteer__* both approve every tool of that server. So the broadest form of approval is the one that never gets flagged. I reproduced this against the PR's code:

  • may_run_code("mcp__plugin_context-mode_context-mode") → False. That entry would pre-approve ctx_execute, the tool REV-007 used.
  • may_run_code("mcp__ctx__*") → False.
  • A settings file with allow: ["mcp__shell", "mcp__ctx__*"] produces a notice that flags mcp__shell and lists mcp__ctx__* without the flag.

The tool is still named, the stage outcome does not change, and the docs call the flag "a hint from the name". That is why this does not block. A suggested fix: treat an entry with no tool segment, or with a * in it, as worth the flag ("pre-approves every tool of server X"). Add a test for both spellings.

[REV-007] · high · not_applicable · debatable · blocks:yes — A reviewer can run any program through an MCP tool that the user's global configuration pre-approves; neither the hook nor the explicit mode nor the sandbox covers it

Not applicable, by owner decision. It is accepted as a documented limitation. I checked that the implementation does what that decision asked:

  • Notice only. A failure in the notice is swallowed (executors.py, try/except around policy_notice). The test test_tools_outside_the_table_are_noticed_once_and_never_stop_the_cycle confirms that the status, the stop reason and the stage sequence match a run without the notice.
  • On this host's real configuration the function lists the three ctx_* tools and flags exactly ctx_execute and ctx_batch_execute, the two tools REV-007 used. ctx_search is listed without a flag.
  • Scope. The notice is active only under an active policy. An inactive one (Bitbucket) carries no preapproved_tools.
  • Safe output. Tool names that come from a clone's .claude/settings*.json reach the report through readable(), which strips control bytes, with backticks replaced and a length cap of 120 per name and 600 for the notice.
  • Docs. The docs describe what the table covers and what it does not, and say it is not a sandbox.

The disposition debatable is kept as it is.

[REV-001] · high · resolved · valid · blocks:yes — Claude's verifying review sandbox gives gh no network, so reviewers cannot read the PR or publish their comment

Re-verified at the head. review_sandbox_settings still allows exactly github.com, api.github.com, bitbucket.org and api.bitbucket.org. The delta does not touch it.

[REV-002] · medium · resolved · valid · blocks:yes — The opt-in global "read-only" set allows git grep, git diff, git log and git show by prefix, which allows running programs and writing files

Re-verified. None of git diff, log, show or grep is in host_permissions.READ_COMMANDS.

[REV-003] · medium · resolved · valid · blocks:no — A denied docker compose run|exec|… still asks a person for the docker_host grant, which cannot unblock it

Re-verified. check("docker compose run x", rereview) gives allowed=False, needs_docker=False.

[REV-004] · low · resolved · valid · blocks:no — The docker blocker misses a grantable docker compose command that redirects into $TMPDIR

Re-verified by test_a_compose_redirected_into_tmpdir_enters_the_grant_flow, which passes in the full run.

[REV-005] · high · resolved · valid · blocks:yes — The stage hook matches Git's program-running options literally, so git grep -iO<cmd> and git grep --open-files=<cmd> run any program

Re-verified. Both spellings are denied at the head.

[REV-006] · high · resolved · valid · blocks:yes — A reviewer inherits the user's auto permission mode, edits .git/config with the Edit tool, and an allowed git status then runs any program

Re-verified. check_file_edit("Edit", …/.git/config) is denied even for implement. Reviewers still get --permission-mode default.

Accumulated review

Across the accumulated diff I found no further correctness, regression or contract problem beyond REV-008. Points checked in this pass:

  • The policy_notice merge happens after the preflight refusal. Only completed runs carry the artifact, which is pre-existing behaviour for policy_note.
  • The per-run dedup by notice text reports a second notice only when a stage's project settings differ, for example the implementer worktree versus the review clone.
  • path in managed compares against the same Path objects.
  • A non-list allow and an unreadable layer are both skipped.

Security triage

The deterministic rule did not fire: security_review.always_when is not declared and the PR has no labels. By judgement it fires, because the change is in the permission layer. The audit ran inline over the delta, not as a separate cc-security-review pass (degraded). The delta only reads settings files, grants nothing, adds no stop path and executes nothing. Untrusted names from the clone are sanitised before they are printed. No vulnerability was found. REV-008 is a gap in how accurate the advisory hint is, not a bypass.

Verification (executed in this rereview's clone, TMPDIR outside the tree, no bytecode written)

Command Result
python3 scripts/validate-package.py exit 0, VALID: 16 skills (7 cycle, 9 supporting), shared sections in sync, cross-agent manifests aligned
python3 -m unittest discover -s tests exit 0, Ran 1595 tests in 224.906s — OK
Probe script against scripts/ at the head (REV-001…007 checks, REV-008 reproduction) outputs as quoted above
git status --porcelain --untracked-files=all after the runs empty; HEAD still 31165bb

Not verified: no live claude -p dispatch was run to see the notice in a real stage report. The unit, dispatch and cycle tests cover how it reaches the report. The Windows shards were not run locally.

CI (parallel policy: read once, not waited for)

Checks on 31165bbaf14db5ebfb2361b172ffc999b142bf2e:

Check State
Skills, manifests, and Bash installer passed
Windows test shard (windows-1) in progress
Windows test shard (windows-2) in progress
Windows test shard (windows-3) in progress
Windows test shard (windows-4) in progress
PowerShell installer not yet reported (runs after the shards)

The cycle's CI gate decides on them.

Residual risk

  • A pre-approved code-running MCP tool can still do anything the user can during a stage. It is named, not prevented, by owner decision.
  • The code-running flag reads only names, and a server-wide approval misses it (REV-008).
  • A user or project sandbox.network.allowedDomains still merges into the review sandbox. This is unchanged.

Verdict: the review is complete for this head, with no open blocking finding. REVIEW_PASSED_AWAITING_CI.

ORCHESTRATION_RESULT (JSON)

ORCHESTRATION_RESULT
{"skill":"cc-rereview","status":"REVIEW_PASSED_AWAITING_CI","issue_provider":"github","issue_id":"142","code_host":"github","change_request_id":"269","change_request_url":"https://github.com/datacas/code-cycle-toolkit/pull/269","pr_number":269,"issue_number":142,"previous_reviewed_head_sha":"7cc18dc85fa86a4f23a148a59027f37d389f2672","reviewed_head_sha":"31165bbaf14db5ebfb2361b172ffc999b142bf2e","head_sha":"31165bbaf14db5ebfb2361b172ffc999b142bf2e","review_run_id":"CCR-20261018-006","reviewer":{"profile":"senior_reviewer","provider":"anthropic","model_requested":"claude-opus-5-5","model_resolved":null,"effort":"high"},"verified_findings":[{"id":"REV-001","severity":"high","blocks_approval":true,"status":"resolved","disposition":"valid"},{"id":"REV-002","severity":"medium","blocks_approval":true,"status":"resolved","disposition":"valid"},{"id":"REV-003","severity":"medium","blocks_approval":false,"status":"resolved","disposition":"valid"},{"id":"REV-004","severity":"low","blocks_approval":false,"status":"resolved","disposition":"valid"},{"id":"REV-005","severity":"high","blocks_approval":true,"status":"resolved","disposition":"valid"},{"id":"REV-006","severity":"high","blocks_approval":true,"status":"resolved","disposition":"valid"},{"id":"REV-007","severity":"high","blocks_approval":true,"status":"not_applicable","disposition":"debatable"}],"new_findings":[{"id":"REV-008","severity":"low","status":"open","disposition":"-","blocks_approval":false,"path":"scripts/stage_permissions.py","line":1292}],"blocking_findings":[],"checks":{"head_sha":"31165bbaf14db5ebfb2361b172ffc999b142bf2e","passed":1,"failed":0,"pending":4},"blocking":false}
END_ORCHESTRATION_RESULT

@datacas

datacas commented Oct 18, 2026

Copy link
Copy Markdown
Owner Author

Owner decision on REV-008: fix it in this PR, do not defer it. A server-wide MCP approval (mcp__<server> or mcp__<server>__*) must be treated like its tools: when the server is known to expose code-running tools (or cannot be told apart), list it with the code-running flag, with the same proportionate wording. Add tests for both forms.

mcp__<server> and mcp__<server>__* approve every tool of that server, so
their name cannot clear them; the notice now flags them and any other MCP
rule with a wildcard, naming what they approve (REV-008).

Refs #142
@datacas

datacas commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner Author

Resolution — PR #269 (work item #142)

[CCR-20261018-001] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-001] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:e3844b3e92a24b5b308f375251614b40a9f512f2 · schema:2

[CCR-20261018-002] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCR-20261018-003] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-002] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:ecb9e4cbc6ce5682e5af1b7b63e064c920a1608f · schema:2

[CCR-20261018-004] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-003] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:250dddf25812cf585dfa52b31d7e067536943022 · schema:2

[CCR-20261018-005] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-004] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:7cc18dc85fa86a4f23a148a59027f37d389f2672 · schema:2

[CCR-20261018-006] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-005] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:31165bbaf14db5ebfb2361b172ffc999b142bf2e · schema:2

Status: RESOLVED. REV-008 is fixed in 736a9274b57a09ef3fa899edebcd0bd5e54e4d30, as the owner decided. This is not an approval: the rereview and the cycle's CI gate decide.

Triage

I judged every finding against 31165bb before editing. REV-008 was the only open one and reproduced at that head: may_run_code("mcp__plugin_context-mode_context-mode") and may_run_code("mcp__ctx__*") both returned False. Its disposition is valid. REV-001…REV-007 keep their status and frozen dispositions.

Findings

[REV-008] · low · resolved · valid · blocks:no — A server-wide MCP approval (mcp__<server> or mcp__<server>__*) is listed without the code-running flag

scripts/stage_permissions.py. The new unnamed_tools function recognises an MCP rule that approves tools it does not name:

  • mcp__<server> and mcp__<server>__* → "every tool of that server";
  • any other MCP rule with a *, such as mcp__ctx__ctx_* or mcp__* → "every tool that pattern matches".

may_run_code counts such a rule as code-running, because it cannot be told apart from one that approves a code-running tool. The notice keeps the same proportionate wording and adds what the rule approves:

…; mcp__shell (every tool of that server), mcp__ctx__* (every tool of that server) can run code or write files, worth a thought when the cycle runs unattended

A rule that names one tool, such as mcp__docs__query-docs or mcp__…__ctx_search, is judged by its name as before, with no flag when the name suggests no writes. docs/host-permissions.md and the Limitations line in CHANGELOG.md describe the server-wide case. The new test test_a_server_wide_mcp_approval_is_flagged covers both spellings, the wildcard variants, named tools that stay unflagged, and the notice text.

[REV-007] · high · not_applicable · debatable · blocks:yes — A reviewer can run any program through an MCP tool that the user's global configuration pre-approves; neither the hook nor the explicit mode nor the sandbox covers it

Unchanged: accepted as a documented limitation by owner decision. This fix only makes the notice more accurate for server-wide approvals.

[REV-001] · high · resolved · valid · blocks:yes — Claude's verifying review sandbox gives gh no network, so reviewers cannot read the PR or publish their comment

Unchanged by this delta.

[REV-002] · medium · resolved · valid · blocks:yes — The opt-in global "read-only" set allows git grep, git diff, git log and git show by prefix, which allows running programs and writing files

Unchanged by this delta.

[REV-003] · medium · resolved · valid · blocks:no — A denied docker compose run|exec|… still asks a person for the docker_host grant, which cannot unblock it

Unchanged by this delta.

[REV-004] · low · resolved · valid · blocks:no — The docker blocker misses a grantable docker compose command that redirects into $TMPDIR

Unchanged by this delta.

[REV-005] · high · resolved · valid · blocks:yes — The stage hook matches Git's program-running options literally, so git grep -iO<cmd> and git grep --open-files=<cmd> run any program

Unchanged by this delta.

[REV-006] · high · resolved · valid · blocks:yes — A reviewer inherits the user's auto permission mode, edits .git/config with the Edit tool, and an allowed git status then runs any program

Unchanged by this delta.

Post-change review (parallel policy: fix delta)

Delta base 31165bbaf14db5ebfb2361b172ffc999b142bf2e, taken from the latest trusted rereview receipt (CCR-20261018-006). It is an ancestor of 736a927. Delta: 4 files, +45/−4. I reviewed it inline, not as a separate delegated pass. No P0/P1 finding. One note: run_cycle caps each name at 120 characters before building the notice. A longer MCP name could then lose its tool segment and get flagged as server-wide. That can only add a flag, never remove one.

Security triage

security_review.always_when is not declared and the PR has no labels, so the deterministic rule did not fire. By judgement the change is in the permission layer. I audited the delta inline, not as a separate cc-security-review pass: it changes only the advisory notice text and the flag, grants nothing, runs nothing and adds no stop path. Names still pass through readable() before they reach the report. No vulnerability found.

Verification (agent-reported, worktree, PYTHONDONTWRITEBYTECODE=1)

Command Result
python3 -m unittest tests.test_stage_permissions tests.test_stage_dispatch exit 0, Ran 91 tests — OK
python3 -m unittest discover -s tests exit 0, Ran 1596 tests in 218.889s — OK
python3 scripts/validate-package.py exit 0, VALID: 16 skills (7 cycle, 9 supporting), shared sections in sync, cross-agent manifests aligned
REV-008 reproduction against the fix mcp__plugin_context-mode_context-mode → True, mcp__ctx__* → True, mcp__docs__query-docs → False
git diff --check exit 0

The tests use no global Git identity or user configuration (temporary settings directories). Not run locally: the Windows shards and a live claude -p dispatch.

CI (parallel policy: read once, not waited for)

Checks on 736a9274b57a09ef3fa899edebcd0bd5e54e4d30:

Check State
Skills, manifests, and Bash installer queued
Windows test shard (windows-1) queued
Windows test shard (windows-2) queued
Windows test shard (windows-3) queued
Windows test shard (windows-4) queued
PowerShell installer not yet reported (runs after the shards)

The cycle's CI gate decides on them.

Residual risk

  • A pre-approved code-running MCP tool can still do anything the user can during a stage. By owner decision it is named, not prevented (REV-007).
  • The flag is still a hint from the name for rules that name one tool.
ORCHESTRATION_RESULT (JSON)

ORCHESTRATION_RESULT
{"skill":"cc-resolve-comments","status":"RESOLVED","issue_provider":"github","issue_id":"142","code_host":"github","change_request_id":"269","change_request_url":"https://github.com/datacas/code-cycle-toolkit/pull/269","pr_number":269,"issue_number":142,"comment_url":"https://github.com/datacas/code-cycle-toolkit/pull/269#issuecomment-6252827006","previous_head_sha":"31165bbaf14db5ebfb2361b172ffc999b142bf2e","head_sha":"736a9274b57a09ef3fa899edebcd0bd5e54e4d30","triage_run_id":"CCT-20261018-005","triaged_sha":"31165bbaf14db5ebfb2361b172ffc999b142bf2e","finding_outcomes":[{"id":"REV-001","disposition":"valid","status":"resolved"},{"id":"REV-002","disposition":"valid","status":"resolved"},{"id":"REV-003","disposition":"valid","status":"resolved"},{"id":"REV-004","disposition":"valid","status":"resolved"},{"id":"REV-005","disposition":"valid","status":"resolved"},{"id":"REV-006","disposition":"valid","status":"resolved"},{"id":"REV-007","disposition":"debatable","status":"not_applicable"},{"id":"REV-008","disposition":"valid","status":"resolved"}],"resolved_findings":[{"id":"REV-008","status":"resolved","commit_sha":"736a9274b57a09ef3fa899edebcd0bd5e54e4d30"}],"unresolved_findings":[],"tests":{"ran":true,"passed":true,"conclusion":"verified_with_reservations","boundary":"not_required","evidence":[{"level":"test","command":"python3 -m unittest tests.test_stage_permissions tests.test_stage_dispatch","exit_code":0,"executed":91},{"level":"test","command":"python3 -m unittest discover -s tests","exit_code":0,"executed":1596},{"level":"static","command":"python3 scripts/validate-package.py","exit_code":0,"executed":null}]},"checks":{"head_sha":"736a9274b57a09ef3fa899edebcd0bd5e54e4d30","passed":0,"failed":0,"pending":5,"items":[{"name":"Skills, manifests, and Bash installer","state":"pending"},{"name":"Windows test shard (windows-1)","state":"pending"},{"name":"Windows test shard (windows-2)","state":"pending"},{"name":"Windows test shard (windows-3)","state":"pending"},{"name":"Windows test shard (windows-4)","state":"pending"}]},"blocking":false}
END_ORCHESTRATION_RESULT

@datacas

datacas commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner Author

Rereview — PR #269 (work item #142)

[CCR-20261018-001] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-001] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:e3844b3e92a24b5b308f375251614b40a9f512f2 · schema:2

[CCR-20261018-002] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCR-20261018-003] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-002] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:ecb9e4cbc6ce5682e5af1b7b63e064c920a1608f · schema:2

[CCR-20261018-004] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-003] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:250dddf25812cf585dfa52b31d7e067536943022 · schema:2

[CCR-20261018-005] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-004] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:7cc18dc85fa86a4f23a148a59027f37d389f2672 · schema:2

[CCR-20261018-006] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-005] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:31165bbaf14db5ebfb2361b172ffc999b142bf2e · schema:2

[CCR-20261018-007] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

Status: REVIEW_PASSED_AWAITING_CI. I reviewed the current head 736a9274b57a09ef3fa899edebcd0bd5e54e4d30 in full and found no open finding that blocks approval. This is not an approval: the required check PowerShell installer has not reported yet, and the cycle's CI gate decides on it.

Correction: this comment first went out by mistake with the body of an earlier rereview (CCR-20261018-004 at 250dddf, a stale local file). This edit replaces that body. Only the content below belongs to this rereview.

What changed since the previous review

The previous rereview (CCR-20261018-006) was at 31165bb. Since then there is one commit, 736a927 (4 files, +45/−4). It implements the owner's decision on REV-008:

  • stage_permissions.unnamed_tools is new. It recognises mcp__<server>, mcp__<server>__ and mcp__<server>__* as approving every tool of a server, and any other MCP rule containing * as a pattern.
  • may_run_code now flags those rules.
  • preapproved_notice adds what each rule approves, for example mcp__shell (every tool of that server).
  • docs/host-permissions.md, the changelog Limitations line and a new test cover the change.

Evidence reviewed

  • Accumulated diff. I used the runtime's evidence file, origin/main...736a927 with merge base 7a95124. It is 5711 lines and its SHA-256 matches the supplied bc01084c…44e4e. It is byte-identical to git diff 7a95124 736a927 in this clone, and GitHub's compare API reports the same merge base, 0 commits behind.
  • What I read. I read every non-test file section of the diff: config, docs, cycle.py, environment_recovery.py, executors.py, grants.py, host_permissions.py, run_cycle.py, stage_permissions.py and the skills. The test sections were exercised through the full suite. I read the delta 31165bb..736a927 in full.
  • Prior state. I recovered it from the 13 earlier PR comments, all by datacas, who is in review.trusted_authors. That gives REV-001…REV-008 with no ID collision and no gap, and two owner decisions (REV-007, REV-008).

Findings

[REV-009] · low · open · - · blocks:no — The 600-character cap on the pre-approved-tools notice can cut off its "can run code" clause, so flagged tools reach the report unflagged

scripts/run_cycle.py:1042 (_preapproved_notice). The notice lists every tool first and appends the clause that flags code-running tools at the end. readable(notice, 600) then cuts the whole line at 600 characters. With about ten pre-approved MCP tools of ordinary length, the cut lands inside the tool list, and the flag clause disappears entirely. That clause is the part the owner's decision required ("flag a tool as worth a thought only when it can run arbitrary code"), and with it go the server-wide flags REV-008 just added.

I reproduced it against the head. _preapproved_notice on eight mcp__plugin_context-mode_context-mode__ctx_* read tools plus …__ctx_execute and mcp__shell returns 601 characters ending in …(the table governs this cycle's Bash commands and file edits…, and "can run code" in notice is False.

This does not block: every tool is still named, the stage outcome is unchanged, and the cap predates this delta (it was already present at 31165bb). Two possible fixes:

  • put the flagged clause before the full list;
  • cap the list instead of the whole line (…, and N more) so the flag clause always survives.

Add a test with a list long enough to hit the cap.

[REV-008] · low · resolved · valid · blocks:no — A server-wide MCP approval (mcp__<server> or mcp__<server>__*) is listed without the code-running flag

Resolved, verified by execution at the head:

  • may_run_code returns True for mcp__plugin_context-mode_context-mode, mcp__ctx__*, mcp__ctx__, mcp__*, mcp__ctx__ctx_* and mcp__a*__tool.
  • It returns False for the named read tools mcp__docs__query-docs and …__ctx_search, and for WebFetch.
  • Given a settings file with allow: ["mcp__shell", "mcp__ctx__*", "mcp__docs__query-docs", "Bash(git:*)"], the notice flags mcp__shell (every tool of that server), mcp__ctx__* (every tool of that server) and leaves the docs tool unflagged.
  • No tools gives no notice.
  • test_a_server_wide_mcp_approval_is_flagged passes.

The stage outcome is untouched; the notice stays advisory.

[REV-007] · high · not_applicable · debatable · blocks:yes — A reviewer can run any program through an MCP tool that the user's global configuration pre-approves; neither the hook nor the explicit mode nor the sandbox covers it

Not applicable, by owner decision. It is accepted as a documented limitation. The delta only makes the notice more accurate. test_tools_outside_the_table_are_noticed_once_and_never_stop_the_cycle still passes. The disposition debatable is kept as it is.

[REV-001] · high · resolved · valid · blocks:yes — Claude's verifying review sandbox gives gh no network, so reviewers cannot read the PR or publish their comment

Re-verified at the head. review_sandbox_settings allows exactly github.com, api.github.com, bitbucket.org and api.bitbucket.org.

[REV-002] · medium · resolved · valid · blocks:yes — The opt-in global "read-only" set allows git grep, git diff, git log and git show by prefix, which allows running programs and writing files

Re-verified. None of those four is in host_permissions.READ_COMMANDS.

[REV-003] · medium · resolved · valid · blocks:no — A denied docker compose run|exec|… still asks a person for the docker_host grant, which cannot unblock it

Re-verified. check("docker compose run x", rereview) gives allowed=False, needs_docker=False.

[REV-004] · low · resolved · valid · blocks:no — The docker blocker misses a grantable docker compose command that redirects into $TMPDIR

Re-verified. denied_docker_blocker on a BLOCKED result with docker compose up > $TMPDIR/x.log returns the docker_host blocker.

[REV-005] · high · resolved · valid · blocks:yes — The stage hook matches Git's program-running options literally, so git grep -iO<cmd> and git grep --open-files=<cmd> run any program

Re-verified. git grep -iOcat x, --open-files=cat x and --open-files-in-pager=cat x are all denied.

[REV-006] · high · resolved · valid · blocks:yes — A reviewer inherits the user's auto permission mode, edits .git/config with the Edit tool, and an allowed git status then runs any program

Re-verified. check_file_edit("Edit", …/.git/config) is denied for implement, and any edit is denied for rereview.

Accumulated review

Beyond REV-009, I found no correctness, regression or contract problem in the accumulated diff. Points checked in this pass:

  • unnamed_tools only ever adds a flag: a non-MCP name returns None, and a named single tool is still judged by its name. The docs and changelog match the code.
  • The resolver noted that the 120-character per-name cap could make a long single-tool name look server-wide. That can only add a flag, never remove one.
  • The docs (host-permissions.md, configuration.md, routing.md, role-workspace-policy.md) describe the same table, hook, sandbox and limits as stage_permissions.py and executors.py.

Security triage

The deterministic rule did not fire: security_review.always_when is not declared and the PR has no labels. By judgement it fires, because the change is in the permission layer. The audit ran inline over the delta and the accumulated permission code, not as a separate cc-security-review pass (degraded).

The delta changes only advisory text and a boolean hint. It grants nothing, runs nothing and adds no stop path. Untrusted names from a clone's .claude/settings*.json still pass through readable() and backtick replacement before reaching the report. No vulnerability was found. REV-009 is an accuracy gap in an advisory notice, not a bypass.

Verification (executed in this rereview's clone, TMPDIR outside the tree, PYTHONDONTWRITEBYTECODE=1)

Command Result
python3 scripts/validate-package.py exit 0, VALID: 16 skills (7 cycle, 9 supporting), shared sections in sync, cross-agent manifests aligned
python3 -m unittest discover -s tests exit 0, Ran 1596 tests in 197.677s — OK
python3 -m unittest tests.test_stage_permissions.ClaudeConfigurationTests.test_a_server_wide_mcp_approval_is_flagged tests.test_stage_dispatch exit 0, Ran 28 tests — OK
Probe script against scripts/ at the head (REV-001…008 checks, REV-009 reproduction) outputs as quoted above
git status --porcelain --untracked-files=all after the runs empty; HEAD still 736a927

Not verified: no live claude -p dispatch was run to see the notice in a real stage report. The Windows shards were not run locally.

CI (parallel policy: read once, not waited for)

Checks on 736a9274b57a09ef3fa899edebcd0bd5e54e4d30. The required checks come from the main ruleset: Skills, manifests, and Bash installer and PowerShell installer.

Check Required State
Skills, manifests, and Bash installer yes passed
PowerShell installer yes not yet reported (runs after the shards)
Windows test shard (windows-1) no pending
Windows test shard (windows-2) no passed
Windows test shard (windows-3) no pending
Windows test shard (windows-4) no pending

The cycle's CI gate decides on them.

Residual risk

  • A pre-approved code-running MCP tool can still do anything the user can during a stage. By owner decision it is named, not prevented (REV-007).
  • The flag is a hint from the name for single-tool rules. A long list can drop the flag clause entirely (REV-009).
  • A user or project sandbox.network.allowedDomains still merges into the review sandbox. This is unchanged.

Verdict: the review is complete for this head, with no open blocking finding. REVIEW_PASSED_AWAITING_CI.

ORCHESTRATION_RESULT (JSON)

ORCHESTRATION_RESULT
{"skill":"cc-rereview","status":"REVIEW_PASSED_AWAITING_CI","issue_provider":"github","issue_id":"142","code_host":"github","change_request_id":"269","change_request_url":"https://github.com/datacas/code-cycle-toolkit/pull/269","pr_number":269,"issue_number":142,"comment_url":"https://github.com/datacas/code-cycle-toolkit/pull/269#issuecomment-6252898879","previous_reviewed_head_sha":"31165bbaf14db5ebfb2361b172ffc999b142bf2e","reviewed_head_sha":"736a9274b57a09ef3fa899edebcd0bd5e54e4d30","head_sha":"736a9274b57a09ef3fa899edebcd0bd5e54e4d30","review_run_id":"CCR-20261018-007","reviewer":{"profile":"senior_reviewer","provider":"anthropic","model_requested":"claude-opus-5-5","model_resolved":null,"effort":"high"},"verified_findings":[{"id":"REV-001","severity":"high","blocks_approval":true,"status":"resolved","disposition":"valid"},{"id":"REV-002","severity":"medium","blocks_approval":true,"status":"resolved","disposition":"valid"},{"id":"REV-003","severity":"medium","blocks_approval":false,"status":"resolved","disposition":"valid"},{"id":"REV-004","severity":"low","blocks_approval":false,"status":"resolved","disposition":"valid"},{"id":"REV-005","severity":"high","blocks_approval":true,"status":"resolved","disposition":"valid"},{"id":"REV-006","severity":"high","blocks_approval":true,"status":"resolved","disposition":"valid"},{"id":"REV-007","severity":"high","blocks_approval":true,"status":"not_applicable","disposition":"debatable"},{"id":"REV-008","severity":"low","blocks_approval":false,"status":"resolved","disposition":"valid"}],"new_findings":[{"id":"REV-009","severity":"low","status":"open","disposition":"-","blocks_approval":false,"path":"scripts/run_cycle.py","line":1042}],"blocking_findings":[],"checks":{"head_sha":"736a9274b57a09ef3fa899edebcd0bd5e54e4d30","passed":3,"failed":0,"pending":4},"blocking":false}
END_ORCHESTRATION_RESULT

@datacas

datacas commented Oct 18, 2026

Copy link
Copy Markdown
Owner Author

Owner decision on REV-009: fix it in this PR. The pre-approved-tools notice must never lose the "can run code" flag to the length cap: list code-running tools first, and when the cap is reached summarize the remainder (for example "… and N more") instead of cutting text mid-clause. Add a test with enough tools to exceed the cap.

…tice is capped

The notice listed every tool before its code-running clause and was then
cut at 600 characters, so a long list lost the flag. Flagged tools now come
first, and a list that does not fit ends in "and N more" instead of being
cut mid-clause (REV-009).

Refs #142
@datacas

datacas commented Oct 18, 2026

Copy link
Copy Markdown
Owner Author

Resolution — PR #269 (work item #142)

[CCR-20261018-001] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-001] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:e3844b3e92a24b5b308f375251614b40a9f512f2 · schema:2

[CCR-20261018-002] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCR-20261018-003] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-002] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:ecb9e4cbc6ce5682e5af1b7b63e064c920a1608f · schema:2

[CCR-20261018-004] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-003] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:250dddf25812cf585dfa52b31d7e067536943022 · schema:2

[CCR-20261018-005] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-004] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:7cc18dc85fa86a4f23a148a59027f37d389f2672 · schema:2

[CCR-20261018-006] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-005] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:31165bbaf14db5ebfb2361b172ffc999b142bf2e · schema:2

[CCR-20261018-007] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-006] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:736a9274b57a09ef3fa899edebcd0bd5e54e4d30 · schema:2

This round resolves REV-009 as the owner decided (comment). I triaged it against 736a927 before editing. Every earlier finding keeps its status and disposition.

Applied fix

[REV-009] · low · resolved · valid · blocks:no — The 600-character cap on the pre-approved-tools notice can cut off its "can run code" clause, so flagged tools reach the report unflagged

scripts/stage_permissions.py (preapproved_notice, new _listed, NOTICE_LIMIT), scripts/run_cycle.py (_preapproved_notice), docs/host-permissions.md, CHANGELOG.md. Fix commit: 9fc0756.

  • The notice now names the code-running tools first, followed by their flag clause, and then the other tools after ; also.
  • Each list is fitted within the 600-character cap. When a list does not fit, it ends in , and N more. When not even one name fits, it becomes N tools. The flag clause and the closing parenthetical are always kept, so the cap can no longer cut the line mid-clause.
  • run_cycle._preapproved_notice still passes the notice through readable() for terminal safety. The two now share NOTICE_LIMIT.
  • The docs/host-permissions.md example and the changelog Limitations entry describe the new order and the and N more summary.

Reproduction, using the reviewer's case (eight …ctx_* read tools, …ctx_execute, mcp__shell):

  • at 736a927: 601 characters, "can run code" in notice is False;
  • at 9fc0756: 568 characters, True, and the notice ends in file edits).

New test: test_a_long_notice_keeps_the_code_running_flag. It covers three lists longer than the cap: a mixed list, ten long code-running names, and read-only tools only. For each it checks the length bound, the flag clause, and N more and the missing …. I updated the existing notice tests in test_stage_permissions.py and test_stage_dispatch.py for the new order.

Earlier findings (unchanged)

[REV-008] · low · resolved · valid · blocks:no — A server-wide MCP approval (mcp__<server> or mcp__<server>__*) is listed without the code-running flag

Fixed in 736a927. Still covered by test_a_server_wide_mcp_approval_is_flagged, which passes at 9fc0756.

[REV-007] · high · not_applicable · debatable · blocks:yes — A reviewer can run any program through an MCP tool that the user's global configuration pre-approves; neither the hook nor the explicit mode nor the sandbox covers it

Owner decision: a documented limitation. The tools are named in the stage report and not blocked.

[REV-001] · high · resolved · valid · blocks:yes — Claude's verifying review sandbox gives gh no network, so reviewers cannot read the PR or publish their comment

[REV-002] · medium · resolved · valid · blocks:yes — The opt-in global "read-only" set allows git grep, git diff, git log and git show by prefix, which allows running programs and writing files

[REV-003] · medium · resolved · valid · blocks:no — A denied docker compose run|exec|… still asks a person for the docker_host grant, which cannot unblock it

[REV-004] · low · resolved · valid · blocks:no — The docker blocker misses a grantable docker compose command that redirects into $TMPDIR

[REV-005] · high · resolved · valid · blocks:yes — The stage hook matches Git's program-running options literally, so git grep -iO<cmd> and git grep --open-files=<cmd> run any program

[REV-006] · high · resolved · valid · blocks:yes — A reviewer inherits the user's auto permission mode, edits .git/config with the Edit tool, and an allowed git status then runs any program

These six were not touched in this round. Their regression tests pass in the full suite below.

Post-change review (fix delta)

  • The delta base is 736a9274b57a09ef3fa899edebcd0bd5e54e4d30, the latest trusted rereview receipt. It is an ancestor of 9fc0756, so I reviewed the fix delta 736a927..9fc0756.
  • I ran the review inline in this stage rather than as a separate cc-code-review pass. It found no new findings.
    • The length bound holds: the code-running list is sized after reserving room for N tools of the other list, so the second list always has at least that room.
    • Order within each list is preserved.
    • No stage outcome, stop path or question changes.
  • Security triage: security_review.always_when is not declared and the PR has no labels. By judgement, the delta changes only advisory text in the permission layer. It grants nothing and runs nothing, and untrusted names still pass through readable() and backtick replacement. I ran no separate cc-security-review, and found no vulnerability.

Verification (agent-reported, run in .worktree/issue-142 with PYTHONDONTWRITEBYTECODE=1)

Command Result
python3 -m unittest tests.test_stage_permissions tests.test_stage_dispatch tests.test_host_permissions exit 0, Ran 112 tests — OK
python3 -m unittest discover -s tests exit 0, Ran 1597 tests in 134.007s — OK
python3 scripts/validate-package.py exit 0, VALID: 16 skills (7 cycle, 9 supporting), shared sections in sync, cross-agent manifests aligned
REV-009 reproduction against HEAD before and after the fix 601 False before, 568 True True after
git status --porcelain --untracked-files=all after the suite only the six intended files, which are now committed

What the local run shares with CI: the tests use no Git identity or credentials. What it does not share: it ran on Linux (WSL2) with Python 3.10, and the Windows shards and the PowerShell installer were not run locally. I ran no live claude -p dispatch.

CI (parallel policy: read once, not waited for)

I read the checks once on 9fc0756cef92932c381eab933251f992e22dd764, right after the push. No check had reported yet. The required Skills, manifests, and Bash installer and PowerShell installer checks count as pending. The cycle's CI gate decides on them.

Residual risk

  • A pre-approved code-running MCP tool can still do anything the user can (REV-007, by owner decision).
  • Flagging is still a hint from the tool's name. When a list is long, some names collapse into and N more, but the flag clause and the count always remain.

Status: RESOLVED. There is no open finding. This stage does not approve the PR.

@datacas

datacas commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner Author

Rereview — PR #269 (work item #142)

[CCR-20261018-001] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-001] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:e3844b3e92a24b5b308f375251614b40a9f512f2 · schema:2

[CCR-20261018-002] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCR-20261018-003] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-002] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:ecb9e4cbc6ce5682e5af1b7b63e064c920a1608f · schema:2

[CCR-20261018-004] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-003] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:250dddf25812cf585dfa52b31d7e067536943022 · schema:2

[CCR-20261018-005] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-004] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:7cc18dc85fa86a4f23a148a59027f37d389f2672 · schema:2

[CCR-20261018-006] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-005] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:31165bbaf14db5ebfb2361b172ffc999b142bf2e · schema:2

[CCR-20261018-007] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

[CCT-20261018-006] · deep_coder · anthropic/claude-opus-5-5→? · high · triaged:736a9274b57a09ef3fa899edebcd0bd5e54e4d30 · schema:2

[CCR-20261018-008] · senior_reviewer · anthropic/claude-opus-5-5→? · high · schema:2

Status: REVIEW_PASSED_AWAITING_CI. I reviewed the current head 9fc0756cef92932c381eab933251f992e22dd764 in full. There is no open finding. This is not an approval: the required check PowerShell installer has not reported yet, and the cycle's CI gate decides on it.

What changed since the previous review

The previous rereview (CCR-20261018-007) was at 736a927. Since then there is one commit, 9fc0756 (6 files, +86/−23). It implements the owner's decision on REV-009:

  • stage_permissions.NOTICE_LIMIT = 600 is new, and run_cycle._preapproved_notice now uses it too.
  • preapproved_notice lists the code-running tools first, followed by the flag clause, then the other tools after ; also.
  • The new _listed helper fits each list into the room left for it. A list that does not fit ends in , and N more, and a list with no room at all becomes N tools.
  • The code-running list reserves room for N tools of the other list, so the flag clause and the closing parenthetical always fit.
  • docs/host-permissions.md, the changelog Limitations entry and the notice tests are updated. test_a_long_notice_keeps_the_code_running_flag is new.

Evidence reviewed

  • Accumulated diff. I used the runtime's evidence file, origin/main...9fc0756 with merge base 7a95124. It has 5774 lines, and its SHA-256 matches the supplied e91aad07…abaf1. It is byte-identical to git diff 7a95124 9fc0756 in this clone. GitHub's compare API reports the same merge base, 12 commits ahead and 0 behind.
  • What I read. I compared every file's accumulated diff against the one CCR-20261018-007 reviewed at 736a927. Only the six files of the delta differ, and I read the delta 736a927..9fc0756 in full. I also read unnamed_tools, may_run_code, _listed, preapproved_notice and run_cycle._preapproved_notice in context at the head.
  • Prior state. I recovered it from the 16 earlier PR comments, all by datacas, who is in review.trusted_authors. That gives REV-001…REV-009 with no ID collision and no gap, plus owner decisions on REV-007, REV-008 and REV-009.

Findings

No new findings.

[REV-009] · low · resolved · valid · blocks:no — The 600-character cap on the pre-approved-tools notice can cut off its "can run code" clause, so flagged tools reach the report unflagged

Resolved, verified by execution at the head:

  • The original reproduction now passes. It uses eight mcp__plugin_context-mode_context-mode__ctx_* read tools, …__ctx_execute and mcp__shell, passed through readable(…, 120) and readable(notice, NOTICE_LIMIT) as run_cycle does. Before the fix the notice was 601 characters and "can run code" in notice was False. Now it is 568 characters, the clause is present, and the notice ends in file edits).
  • A property check passed on 20,000 random lists. Each list held 1–40 tools, mixing named tools, server-wide rules and long names. In every case:
    • the notice is at most 600 characters;
    • the final readable(notice, 600) returns it unchanged, so nothing is cut;
    • it contains no … other than in names that were already shortened;
    • it ends with the closing parenthetical;
    • it contains the flag clause exactly when at least one tool is flagged.
  • test_a_long_notice_keeps_the_code_running_flag and the updated notice tests pass.

The fix follows the owner's decision: code-running tools come first, and the rest are summarised as and N more rather than cut mid-clause.

[REV-008] · low · resolved · valid · blocks:no — A server-wide MCP approval (mcp__<server> or mcp__<server>__*) is listed without the code-running flag

Re-verified. may_run_code gives True for mcp__shell, mcp__ctx__* and mcp__ctx__, and False for mcp__docs__query-docs. In the new order, the server-wide suffix (every tool of that server) is still listed with the flagged tools.

[REV-007] · high · not_applicable · debatable · blocks:yes — A reviewer can run any program through an MCP tool that the user's global configuration pre-approves; neither the hook nor the explicit mode nor the sandbox covers it

Not applicable, by owner decision. It is accepted as a documented limitation. The delta changes only the order and length of the notice that names these tools. The disposition debatable is kept as it is.

[REV-001] · high · resolved · valid · blocks:yes — Claude's verifying review sandbox gives gh no network, so reviewers cannot read the PR or publish their comment

Re-verified at the head. review_sandbox_settings allows exactly api.bitbucket.org, api.github.com, bitbucket.org and github.com.

[REV-002] · medium · resolved · valid · blocks:yes — The opt-in global "read-only" set allows git grep, git diff, git log and git show by prefix, which allows running programs and writing files

Re-verified. None of those four is in host_permissions.READ_COMMANDS.

[REV-003] · medium · resolved · valid · blocks:no — A denied docker compose run|exec|… still asks a person for the docker_host grant, which cannot unblock it

Re-verified. check("docker compose run x", rereview) gives allowed=False, needs_docker=False.

[REV-004] · low · resolved · valid · blocks:no — The docker blocker misses a grantable docker compose command that redirects into $TMPDIR

Re-verified. denied_docker_blocker on a BLOCKED result with docker compose up > $TMPDIR/x.log returns the docker_host blocker.

[REV-005] · high · resolved · valid · blocks:yes — The stage hook matches Git's program-running options literally, so git grep -iO<cmd> and git grep --open-files=<cmd> run any program

Re-verified. git grep -iOcat x, --open-files=cat x and --open-files-in-pager=cat x are all denied.

[REV-006] · high · resolved · valid · blocks:yes — A reviewer inherits the user's auto permission mode, edits .git/config with the Edit tool, and an allowed git status then runs any program

Re-verified. check_file_edit("Edit", …/.git/config) is denied for implement, and any edit is denied for rereview.

Accumulated review

I found no correctness, regression or contract problem in the accumulated diff. Points checked in this pass:

  • _listed is consistent. The string it returns is the one it measured, because rest at the last accepted name equals the final hidden. Order is preserved, and 1 tool and N tools are handled.
  • The fallback is bounded. With no room for even one name, N tools is unbounded only for a caller-supplied limit smaller than the fixed text. The only callers use the default 600.
  • No other behaviour changed. The notice remains advisory: no stage outcome, stop path or question changes. test_tools_outside_the_table_are_noticed_once_and_never_stop_the_cycle still passes.
  • Docs and code agree. The docs example and the changelog entry match the code's actual output order.

Security triage

The deterministic rule did not fire: security_review.always_when is not declared and the PR has no labels. By judgement it fires, because the change is in the permission layer. The audit ran inline over the delta and the notice path, not as a separate cc-security-review pass (degraded).

The delta changes only advisory text. It grants nothing, runs nothing and adds no stop path. Untrusted names from a clone's .claude/settings*.json still pass through readable() and backtick replacement before reaching the report, and the final readable() remains as a guard. No vulnerability was found.

Verification (executed in this rereview's clone, TMPDIR outside the tree, PYTHONDONTWRITEBYTECODE=1)

Command Result
python3 scripts/validate-package.py exit 0, VALID: 16 skills (7 cycle, 9 supporting), shared sections in sync, cross-agent manifests aligned
python3 -m unittest discover -s tests exit 0, Ran 1597 tests in 260.911s — OK
Probe script against scripts/ at the head (REV-001…009 checks, REV-009 reproduction, 20,000-case property check) exit 0, outputs as quoted above, failures 0
git status --porcelain --untracked-files=all after the runs empty; HEAD still 9fc0756

Not verified: I ran no live claude -p dispatch to see the notice in a real stage report, and I did not run the Windows shards locally.

CI (parallel policy: read once, not waited for)

Checks on 9fc0756cef92932c381eab933251f992e22dd764. The required checks come from the main ruleset: Skills, manifests, and Bash installer and PowerShell installer.

Check Required State
Skills, manifests, and Bash installer yes passed
PowerShell installer yes not yet reported (runs after the shards)
Windows test shard (windows-1) no pending
Windows test shard (windows-2) no passed
Windows test shard (windows-3) no pending
Windows test shard (windows-4) no pending

The cycle's CI gate decides on them.

Residual risk

  • A pre-approved code-running MCP tool can still do anything the user can during a stage. By owner decision it is named, not prevented (REV-007).
  • For single-tool rules, the flag is a hint from the tool's name. When a list is long, some names collapse into and N more, but the flag clause and the count always remain.
  • A user or project sandbox.network.allowedDomains still merges into the review sandbox. This is unchanged.

Verdict: the review is complete for this head, with no open finding. REVIEW_PASSED_AWAITING_CI.

ORCHESTRATION_RESULT (JSON)

ORCHESTRATION_RESULT
{"skill":"cc-rereview","status":"REVIEW_PASSED_AWAITING_CI","issue_provider":"github","issue_id":"142","code_host":"github","change_request_id":"269","change_request_url":"https://github.com/datacas/code-cycle-toolkit/pull/269","pr_number":269,"issue_number":142,"comment_url":"https://github.com/datacas/code-cycle-toolkit/pull/269#issuecomment-6253371209","previous_reviewed_head_sha":"736a9274b57a09ef3fa899edebcd0bd5e54e4d30","reviewed_head_sha":"9fc0756cef92932c381eab933251f992e22dd764","head_sha":"9fc0756cef92932c381eab933251f992e22dd764","review_run_id":"CCR-20261018-008","reviewer":{"profile":"senior_reviewer","provider":"anthropic","model_requested":"claude-opus-5-5","model_resolved":null,"effort":"high"},"verified_findings":[{"id":"REV-001","severity":"high","blocks_approval":true,"status":"resolved","disposition":"valid"},{"id":"REV-002","severity":"medium","blocks_approval":true,"status":"resolved","disposition":"valid"},{"id":"REV-003","severity":"medium","blocks_approval":false,"status":"resolved","disposition":"valid"},{"id":"REV-004","severity":"low","blocks_approval":false,"status":"resolved","disposition":"valid"},{"id":"REV-005","severity":"high","blocks_approval":true,"status":"resolved","disposition":"valid"},{"id":"REV-006","severity":"high","blocks_approval":true,"status":"resolved","disposition":"valid"},{"id":"REV-007","severity":"high","blocks_approval":true,"status":"not_applicable","disposition":"debatable"},{"id":"REV-008","severity":"low","blocks_approval":false,"status":"resolved","disposition":"valid"},{"id":"REV-009","severity":"low","blocks_approval":false,"status":"resolved","disposition":"valid"}],"new_findings":[],"blocking_findings":[],"checks":{"head_sha":"9fc0756cef92932c381eab933251f992e22dd764","passed":2,"failed":0,"pending":4},"blocking":false}
END_ORCHESTRATION_RESULT

@datacas
datacas merged commit 3091cf3 into main Oct 18, 2026
6 checks passed
@datacas
datacas deleted the issue-142-host-permissions branch October 18, 2026 18:50
datacas added a commit that referenced this pull request Oct 19, 2026
* fix(cycle): let read-only stages write only inside their $TMPDIR

Since #269 a review, rereview or issue review could write no file, so the
comment body its skill writes to $TMPDIR/pr-comment.md for --body-file
could not exist and no review could publish. The hook now allows those
stages to edit paths that resolve strictly inside the dispatch's TMPDIR,
and allowed_tool_patterns grants one Edit(//<tmpdir>/**) rule so Claude's
default permission mode approves the same write. The repository, .git,
Git's configuration, sibling temporary directories, '..' and symlinks out
of TMPDIR stay refused.

Closes #272

* fix(cycle): grant read-only stages only their named helper files in $TMPDIR

REV-001 on PR #273: Edit(//<tmpdir>/**) also covered the files Claude keeps
in the same directory (materialised settings, tasks/ output,
bash-edit-diff/), so a read-only stage could overwrite a background
verification log. Both barriers now name only pr-comment.md, report.md,
reply.md and top-level <check>.log, and the hook refuses a helper name that
is not directly in $TMPDIR or resolves to another file there.

Refs #272
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recommended host permissions for Claude/Codex and per-project generalized approvals

1 participant