Repository navigation
fix(pr-verify): route the capture's outer leg through the key proxy and narrow its Bash - #13770
Conversation
The capture's driver legs ran Claude Code holding the real PR_VERIFY_CLAUDE_API_KEY with unrestricted Bash. Owner decision Q7 (a) and Q9 (c) on #12232: route them through the key proxy with a dummy key, and narrow their Bash to the driver and git. - key-proxy.mjs: --listen <port> adds a loopback TCP listener in the same process. It reads a per-run client key from stdin's second line, refuses any request without it with a 401 (SHA-256 digests compared with timingSafeEqual), keeps its own budget and state, and relays a non-200 count_tokens preflight answer as sent, so a credit stop or a refused key still reaches run-claude-cli's handoff classification. The socket listener is unchanged. - pr-verify-capture.yml: run-claude-cli and apply-claude-managed-settings move to 4aba9be (loopback-base-url). The managed settings file is the machine's one, so both the probe and the capture leg take the client key, the loopback port 47101 and the Claude Code version the proxy's betas were measured on. The settings add NO_PROXY for the loopback and the nonessential-traffic switch, the output-token cap and the small model the driven session already pins: measured on 2.1.318, the leg otherwise sends two betas the proxy refuses and max_tokens 128000. The real key now reaches only "Start the key proxy"; a new step checks that the managed settings and every readable process environment hold no value hashing to it. The capture leg's bare Bash rule becomes per-verb rules for main's driver and named git commands on the head. - callers.test.mjs: 4aba9be passes --permission-prompts none (lane.cjs:425-426). Refs: #13710 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The capture leg's skills name commands beyond the driver and the head's local git: run-e2e's resolve-config.sh and check-browser-driver.sh, drive's `claude plugin list --json`, cmp for the revert proof, and the default branch's ls-remote and fetch. Each gets a named rule, from main's checkout only. ls-remote and fetch are exact (origin, HEAD, main), since `fetch *` or `ls-remote *` would admit --upload-pack, which runs a program. The workflow test checks each rule and that curl, wget, python, node -e, bash -c and a head copy of a script stay refused. Refs: #13710 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…roxy # Conflicts: # .github/workflows/pr-verify-capture.yml
The capture prompt runs the leg from the head checkout, so a relative .base/ or head path in a Bash allow rule named a file the pull request can commit, and the rule then ran head code outside the sandbox. run-claude-cli resolves every plugin-dirs entry to an absolute path, so the skills already name the absolute forms; the relative rules go. The key proxy comment now says the socket is reachable by any runner-user process and the job can spend up to twice the cap. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
The runner worker runs as the runner user and holds the job's secrets in memory; only Yama's ptrace_scope keeps its descendants from attaching to it. "Check the driver legs hold no real key" now reads the value, prints it for the run record, and fails before any driver leg when it is below 1 or unreadable. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
claude-security-review reviewed Security review: PR #13770 (head abf5089), incremental since 3db0747I found no security issues. This was an incremental review. I read every hunk of the 2 files changed since 3db0747: critical-findings: 0 What I checked
|
|
claude-review reviewed Code review (incremental, blocking only): ptrace_scope gate in "Check the driver legs hold no real key"This lane already reviewed an earlier head ( What checks out
Findings: none blocking in this push. Prior findings: the earlier summary comment (the advisory about the driver model and the proxy's Verification: I ran nothing; this lane has no shell. Any pass counts or results for this push are the author's claims and unverified. Closing issue: the PR closes no issue; it only references #13710. |
Refs: #13710
Summary
The PR capture's outer leg, the key-holding Claude Code that drives the sandboxed app, no longer holds the real
PR_VERIFY_CLAUDE_API_KEY. It runs on a per-run client key through the key proxy, and its Bash is narrowed to named commands. Owner decision Q7 (a) and Q9 (c): issuecomment-6686203326. It uses theloopback-base-urlopt-in from melodic-software/ci-workflows#1000 (merged as 4aba9be).Fix
ccd-outer-<64 hex>, compared as SHA-256 digests withtimingSafeEqual; a missing or wrong key gets 401. The key is generated and masked in "Start the key proxy" and reaches the proxy on stdin line 2. A socat bridge could not check a key, which is why the proxy listens directly. The driven sandbox listener is unchanged.run-claude-cliandapply-claude-managed-settingsare pinned to 4aba9be withloopback-base-url: http://127.0.0.1:47101. The bump also brings in ci-workflows 17985f4, which gives the fallback leg an empty subscription token.PR_VERIFY_CLAUDE_API_KEYnow reaches only "Start the key proxy". The managed env addsNO_PROXY, the nonessential-traffic switch, the output cap at the ceiling and the haiku model; on Claude Code 2.1.318 that removed the inline-tools and advisor betas,HEAD /api/helloandmax_tokens 128000, measured locally. A new step, "Check the driver legs hold no real key", hashes every managed-settings value and every readable environ value against the real key, using the client key as a canary. The probe leg uses the same client key and port, because one/etc/claude-code/managed-settings.jsonserves every leg.plugins,launch,ready,screenshot,record,log,stop) for both path forms.git -C headwith exact read commands (branch --show-current,status --porcelain,diff HEAD,diff --name-only <base>...HEAD,rev-parse --show-toplevel,worktree list --porcelain) and the exact network forms the e2e context names (ls-remote --symref origin HEAD,fetch origin main). Also the named skill commands:resolve-config.sh e2e *,check-browser-driver.sh --user *,claude plugin list --jsonandcmp *. dontAsk denies everything else.Verification
key-proxy.test.mjs45 pass,workflow.test.mjs78 pass, pr-verify suites pluscallers.test.mjs636 pass. 10 new or changed tests fail on the old code. The workflow test checks that these stay refused:curl,wget,python -c,node -e,bash -c, a head copy ofresolve-config.sh,claude -p,claude plugin install, a fetch from another branch or URL, and--upload-packforms.Remaining
capture.statusjudged, needs a capture run on main after this merges. The PR_VERIFY key's promotional credit must refresh first (perf(pr-verify): set the capture key proxy's token-cap from a full measured capture #13724). That run will also show whetherrun-e2e's revert proof, which redirectsgit diff HEADoutside the tree, is denied under dontAsk, and whether the model usesgit -C headwhen acd head && gitform is denied.Related
🤖 Generated with Claude Code