Repository navigation
feat(harness-ops): add a live behavior probe for the subprocess env scrub - #12723
Conversation
…ential Tests only asserted that lanes set CLAUDE_CODE_SUBPROCESS_ENV_SCRUB, so a release could change what it does with no check failing. Add an env-scrub area to behavior-probes: a real turn with a random fake credential planted, a checker that compares hashes of its environment and every readable /proc/<pid>/environ, and a paired control with the scrub off. The runner gains plant_env, a fresh per-run value that reaches only the child environment, and target.result_match, which reads a tool result not of the expected shape as inconclusive rather than fail. Both cases passed live on Claude Code 2.1.317 (record 20). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Q4SUwLX9M3bKXJidsD
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Q4SUwLX9M3bKXJidsD
The checker stopped at its own environment, so the scrub-off control never showed another process's environ is readable, and an unreadable /proc let the scrub-on case pass falsely. The checker now reports its own environment and other processes' environ separately, leaving its own process out of the scan, and crashes with no marker when it cannot read /proc/self/environ. The control passes only when both channels find the value; the scrub-on case only when neither does. run_case refuses a plant_env case that is not verdict_only before planting. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VQb9Q4SUwLX9M3bKXJidsD
Codex Review SummaryThis 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. |
|
claude-security-review reviewed Security review: PR #12723 (env-scrub behavior probe)No security issues found. Scope. I read every hunk in the full diff. That covers 12 of the 14 listed files. The other two are What I checked:
Spend (not a finding): each live case run is capped at critical-findings: 0 |
|
claude-review reviewed Code review: no findingsI read all 14 changed files. Two pairs are identical copies ( What I checked
Closing issue #12702, acceptance criteria
Not verified: the live run in record 20 and the "80 tests pass" result come from the PR author. I had no shell and ran nothing. No embedded instructions were found in the PR context or the prior-findings file. Spend: each live run of these cases uses prepaid API credit, capped at |
Closes #12702
Summary
Adds an
env-scrubarea to/harness-ops:behavior-probes: a live case with a paired control that checksCLAUDE_CODE_SUBPROCESS_ENV_SCRUBkeeps a planted fake credential away from a Bash child. Lanes rely on the scrub, and until now only that the variable was set was tested, so a Claude Code release could change the behavior with no check failing.Fix
cases/lib/plant-check.pyreads two channels independently (its own/proc/self/environ, and every other readable/proc/<pid>/environ), compares sha256 hashes, and prints a fixed marker naming both. It cannot read its own environ: it crashes with no marker, which the case reads asinconclusive.scripts/probe.pygainsplant_env(a freshsecrets.token_hex(32)value per run, reaching only the child environment, with only its hash on disk) andtarget.result_match. Aplant_envcase must beverdict_only, invalidateand again inrun_casebefore planting.own=not-found others=not-found. The control passes only onown=found others=found, and the scrub-on pass holds only while the control passes.AWS_SECRET_ACCESS_KEY, a variable the docs say the scrub removes. What the scrub removes and keeps is left to the linked docs section, not restated.Verification
probe.py validate: 50 cases, 0 problems.probe.test.sh: 80 tests pass, run by the orchestrator on this head.19ccaf93d5.Known limits:
CLAUDE_CODE_OAUTH_TOKENwould replace the turn's own authentication, so no run shows the scrub removing that token.others=foundcan come from any other process holding the value, such as the Bash tool's own shell. It shows/procreads cross a process boundary, not thatclaude's environ was the one read; record 20 says so. The control'sclaimline inexpect.jsonreads stronger than that./proc/self/environwould printown=not-found; not exercised./harness-ops:changelogflags it only when a release note matches its tags.Related
docs/upstream/mattpocock-sandcastle.mdin docs(upstream): record what to take from mattpocock/sandcastle #12676 records where the idea came from.🤖 Generated with Claude Code
https://claude.ai/code/session_01VQb9Q4SUwLX9M3bKXJidsD