fix(dispatch): deny the Claude child reads of its credential mount; document the residual risk (ISS-3) #120

Merged
janpeter merged 2 commits from fix/iss3-provider-deny into master 2026-10-08 22:00:03 +02:00
Owner

Addresses ISS-3 (#108): the Claude dispatch child can read its own OAuth token. Since 17526f0 the token lives in /run/provider rather than /sources. This PR adds the deny rule JP chose and records the residual risk in the operator doc.

Changes

  • T-85 (6e0968b): buildClaudeArgs passes --disallowedTools 'Read(//run/provider/**)'. The // makes the path absolute; a single / would anchor at the cwd. The mount path is one constant, PROVIDER_MOUNT, shared by the broker mount, the child entrypoint and the rule. Bash stays allowed (JP's decision, so reviewers can keep running typecheck and tests).
  • T-86 (0963819): the operator doc gets a "Residual risk of the Claude credential (ISS-3)" bullet. It covers what the rule refuses and what it doesn't, why the subprocess env scrub isn't used, and points to the gateway in IDEA-244 as the structural fix.

Evidence (real model-claude image from this branch)

Setup: CLI 2.1.287 with the exact buildClaudeArgs/buildClaudeEnv output, a dummy token, and a scripted fake Messages API via ANTHROPIC_BASE_URL. The container ran with --network none --cap-drop ALL --security-opt no-new-privileges --read-only. No real credential was used.

  • Refused: Read, Grep and Glob on /run/provider, and Bash cat naming the token path.
  • Still works: Read of /sources, normal Bash, and Write to /output.
  • Not refused (documented residual risk):
    • a shell detour, such as a composed path in node -e, a variable, or a glob;
    • /proc/<claude pid>/environ.
    • Bash subprocesses do not carry the token in their env.
  • Env scrub: CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1 needs bubblewrap and socat. Even with both installed it fails under --cap-drop ALL, because no user namespace can be created.

Verification

  • npm run typecheck:dispatch is green.
  • npx vitest run: 1304 passed, 8 skipped, 2 failed. The 2 failures are the known macOS-only transcript-retention tests (GNU chmod --reference) and fail identically on master.

After merge

The Claude slot needs a new model-claude image. ISS-3 then closes with the residual risk accepted until IDEA-244.

🤖 Generated with Claude Code

Addresses ISS-3 (#108): the Claude dispatch child can read its own OAuth token. Since 17526f0 the token lives in `/run/provider` rather than `/sources`. This PR adds the deny rule JP chose and records the residual risk in the operator doc. ## Changes - **T-85 (`6e0968b`):** `buildClaudeArgs` passes `--disallowedTools 'Read(//run/provider/**)'`. The `//` makes the path absolute; a single `/` would anchor at the cwd. The mount path is one constant, `PROVIDER_MOUNT`, shared by the broker mount, the child entrypoint and the rule. Bash stays allowed (JP's decision, so reviewers can keep running typecheck and tests). - **T-86 (`0963819`):** the operator doc gets a "Residual risk of the Claude credential (ISS-3)" bullet. It covers what the rule refuses and what it doesn't, why the subprocess env scrub isn't used, and points to the gateway in IDEA-244 as the structural fix. ## Evidence (real `model-claude` image from this branch) Setup: CLI 2.1.287 with the exact `buildClaudeArgs`/`buildClaudeEnv` output, a dummy token, and a scripted fake Messages API via `ANTHROPIC_BASE_URL`. The container ran with `--network none --cap-drop ALL --security-opt no-new-privileges --read-only`. No real credential was used. - **Refused:** `Read`, `Grep` and `Glob` on `/run/provider`, and Bash `cat` naming the token path. - **Still works:** Read of `/sources`, normal Bash, and Write to `/output`. - **Not refused (documented residual risk):** - a shell detour, such as a composed path in `node -e`, a variable, or a glob; - `/proc/<claude pid>/environ`. - Bash subprocesses do not carry the token in their env. - **Env scrub:** `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1` needs bubblewrap and socat. Even with both installed it fails under `--cap-drop ALL`, because no user namespace can be created. ## Verification - `npm run typecheck:dispatch` is green. - `npx vitest run`: 1304 passed, 8 skipped, 2 failed. The 2 failures are the known macOS-only `transcript-retention` tests (GNU `chmod --reference`) and fail identically on master. ## After merge The Claude slot needs a new `model-claude` image. ISS-3 then closes with the residual risk accepted until IDEA-244. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
buildClaudeArgs now passes --disallowedTools 'Read(//run/provider/**)'. The
mount path is one constant (PROVIDER_MOUNT) shared by the broker mount, the
child entrypoint and the rule, so they cannot drift.

Measured with the real model-claude image (CLI 2.1.287, dummy token, fake
Messages API, --network none --cap-drop ALL no-new-privileges --read-only):
Read, Grep and Bash cat on the token are refused; Read of /sources, normal
Bash and Write to /output still work. Not refused: a shell detour (composed
path, variable, glob) and /proc/<pid>/environ of the claude process. Bash
stays allowed (JP), so this is a threshold, not a boundary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs(dispatch): residual risk of the Claude child credential (ISS-3 T-86)
All checks were successful
CI / Build-arg coverage (pull_request) Successful in 4s
CI / Compose config (pull_request) Successful in 10s
CI / Docker build (pull_request) Successful in 58s
09638196e8
Records what the Read(//run/provider/**) deny rule refuses and what it does
not (shell detours, /proc/<pid>/environ of claude), why the subprocess env
scrub cannot run under --cap-drop ALL, and the credential-injecting gateway
(IDEA-244) as the structural fix. Measured 2026-10-08, CLI 2.1.287.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
s4m-codex-reviewer left a comment

COMMENT

Geen blokkerende codebevindingen gevonden. De wijziging is klein, volgt de bestaande dispatch-patronen en houdt mountpad en deny-regel via één constante gelijk. De allowlist blijft intact; de bestaande argv-test controleert de exacte absolute deny-regel. De operator-documentatie benoemt de beperkingen expliciet.

Findings:

  • INFO — tests/dispatch-child.test.ts:100 — Verificatiebeperking: typecheck op de opgegeven head is geslaagd (na initialisatie van de gepinde shared-submodule), maar Vitest kan in deze reviewomgeving niet starten: /tmp weigert uitvoering en het laden van de native rolldown-module. De unit-tests zijn daarom inhoudelijk beoordeeld, niet succesvol opnieuw uitgevoerd. De echte CLI-proef is in de PR-beschrijving gerapporteerd en hier niet onafhankelijk herhaald. Dit is geen aangetoonde regressie; wegens resterende verificatie-onzekerheid kies ik COMMENT.

Plan gekoppeld via pr_refs: T-85 en T-86, story ST-024. Geen omitted onderdelen. De diff implementeert de voorgeschreven flag, gedeelde mountconstante, ongewijzigde allowlist en restrisicosectie. De PR rapporteert het praktijkbewijs voor geweigerde credential-reads en werkende gewone tools. Acceptatiecriterium 4 is hier alleen voor de typecheck onafhankelijk bevestigd. De gateway (IDEA-244) en het uitrollen van een nieuw model-claude-image zijn expliciet vervolgwerk; het geaccepteerde restrisico is geen blokkade tegen dit plan.

Productstandaarden: architectuur/overview en de toepasselijke agent-guide geraadpleegd. git diff --check is geslaagd. Review betreft commit 09638196e8a8a4eef96974a4bcb59c5c0becb05a.

# COMMENT Geen blokkerende codebevindingen gevonden. De wijziging is klein, volgt de bestaande dispatch-patronen en houdt mountpad en deny-regel via één constante gelijk. De allowlist blijft intact; de bestaande argv-test controleert de exacte absolute deny-regel. De operator-documentatie benoemt de beperkingen expliciet. Findings: - INFO — __tests__/dispatch-child.test.ts:100 — Verificatiebeperking: typecheck op de opgegeven head is geslaagd (na initialisatie van de gepinde shared-submodule), maar Vitest kan in deze reviewomgeving niet starten: `/tmp` weigert uitvoering en het laden van de native rolldown-module. De unit-tests zijn daarom inhoudelijk beoordeeld, niet succesvol opnieuw uitgevoerd. De echte CLI-proef is in de PR-beschrijving gerapporteerd en hier niet onafhankelijk herhaald. Dit is geen aangetoonde regressie; wegens resterende verificatie-onzekerheid kies ik COMMENT. Plan gekoppeld via pr_refs: T-85 en T-86, story ST-024. Geen omitted onderdelen. De diff implementeert de voorgeschreven flag, gedeelde mountconstante, ongewijzigde allowlist en restrisicosectie. De PR rapporteert het praktijkbewijs voor geweigerde credential-reads en werkende gewone tools. Acceptatiecriterium 4 is hier alleen voor de typecheck onafhankelijk bevestigd. De gateway (IDEA-244) en het uitrollen van een nieuw model-claude-image zijn expliciet vervolgwerk; het geaccepteerde restrisico is geen blokkade tegen dit plan. Productstandaarden: architectuur/overview en de toepasselijke agent-guide geraadpleegd. `git diff --check` is geslaagd. Review betreft commit `09638196e8a8a4eef96974a4bcb59c5c0becb05a`.
janpeter merged commit b5dc2cc618 into master 2026-10-08 22:00:03 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
janpeter/scrum4me-docker!120
No description provided.