(fix) spawn: scrub the ambient credential inputs and the endpoint pair the isolation missed (issue #1535) #1536
All Vouch review confidence checks passed
Residual risk 0.23 = Change Risk (0.57) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.57 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #1536"
general
weight: 0.35
alexey-pelykh
Closes #1535.
Closes #1625.
SPAWN_ENV_REMOVEis the list of variables sessiometer removes from each environment it builds for an isolated spawn, and it was missing five inputs that Claude Code reads. Three of them decide the credential the child uses.ANTHROPIC_AUTH_TOKENsupplies one.CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTORnames a descriptor Claude Code reads an OAuth token from. That token outranks the seeded keychain item while the descriptor is readable and no access token from theCLAUDE_BG_AUTH_SNAPSHOT_PATHsnapshot was consumed first.CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR, when set, can stop the child's API clients from using the claude.ai login, and it supplies an API key while its descriptor is readable. The other two decide where the credential goes.ANTHROPIC_BASE_URLsets the host that Claude Code's first-party API client sends the child's credential to. On that client, a customAuthorizationheader fromANTHROPIC_CUSTOM_HEADERSreplaces the bearer the client builds, unless Claude Code writes its ownAuthorizationover it. That is a static read; no run set the variable. The list already removed two more credential inputs,CLAUDE_CODE_OAUTH_TOKENandANTHROPIC_API_KEY. Inherited, the five credential inputs do not all act the same way. In a 2026-11-02 run of the refresh child, withCLAUDE_CODE_OAUTH_TOKENor a readable OAuth descriptor inherited, the child attempted no connection to the token host before it timed out. WithANTHROPIC_API_KEYorANTHROPIC_AUTH_TOKEN, it still attempted that connection. With the API-key descriptor variable set and nothing readable behind it, it exited 1 withNot logged in · Please run /login. In a separate run with no credential in the environment, a dummy stored token reached an inherited base URL asAuthorization: Bearer. The three credential inputs and the two endpoint inputs the list was missing are now removed from the environment that each of the three seams builds: the refresh spawn, the login spawn and the issue #783 login-shell PATH harvest.What changed
src/isolated_spawn.rs—SPAWN_ENV_REMOVEgainsANTHROPIC_AUTH_TOKEN(the contributor's commit),CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTORandCLAUDE_CODE_API_KEY_FILE_DESCRIPTOR(#1535), andANTHROPIC_BASE_URLandANTHROPIC_CUSTOM_HEADERS(#1625). Its doc comment states the membership rule: an input is eligible when Claude Code reads it to decide which credential, credential store or OAuth client identity the child uses, or which host receives that credential, and eligibility is not membership. The doc comment names Claude Code 2.1.294 as the version the precedence was read at and cites the ledger section below. It says what each input supplies or selects, and it no longer claims that every inherited credential input stops the refresh.the_recorded_env_credential_sources_are_scrubbed_by_name(#1535) pins the five credential inputs by name at all three seams.the_base_url_and_its_companion_headers_are_scrubbed_by_name(#1625) pins the two endpoint inputs the same way. Deleting any of those names from the list fails a test with a message that names the seam and the variable.refresh_plan_builds_the_legacy_commandpins the five new removals in its hand-written env map. Ascrub_seams()helper builds the three seams once for the scrub tests. The login plan's#[cfg_attr(not(test), allow(dead_code))]attributes in this file are dropped, becauselogin_accountbuilds that plan in production.build/version-compat.md— a new section,# Issue #1535 — environment inputs Claude Code consults ahead of the claude.ai login (CC 2.1.294), records the selection order read statically from the stock 2.1.294 binary: the login gate, the OAuth bearer builder and the API-key resolver, each with the byte offsets that locate it. Its subsection onANTHROPIC_BASE_URLandANTHROPIC_CUSTOM_HEADERSrecords why both are on the list, with the 2026-11-02 measurements. The section also lists the inputs the scrub leaves out with their reasons, what the read did not settle, and what would falsify it. The 2.1.207 "auth-source precedence" note gains a dated pointer: its order is the source-labelling order, not the selection order. TheCC_SUPPORTED_MINandCC_SUPPORTED_MAXlines are unchanged.docs/specs/spawn-env-scrub.feature.md— Rule 5 covers the #1535 variables. Rule 6 covers the #1625 pair with three scenarios, the third being the measured case of a stored token sent as the bearer to an inherited base URL. The title now covers variables that decide where the credential goes, and the header counts match the rules and examples.README.md— the paragraph on the official CLI's own network calls now says those calls run under that account's credential. It says sessiometer removes the variables listed inSPAWN_ENV_REMOVEfrom the environment it builds for those children, so they do not inherit a credential or a gateway that your shell sets through those variables. It no longer says the calls go "to Anthropic" under "your credential", "exactly as it would if you ran it yourself".Decisions
The maintainer delegated both decisions to councils on 2026-11-02.
ANTHROPIC_BASE_URL. It is scrubbed in this PR together withANTHROPIC_CUSTOM_HEADERS, under #1625, after a security, a Rust and a delivery member converged with high confidence. Their shared falsifier ran and did not fire: with no credential in the environment, a stored token reached an inherited base URL asAuthorization: Bearer.src/login.rs,src/capture.rsandsrc/paths.rs, and to the scrub-guard name insrc/refresh.rs, are out of this PR and go to their own PR for #1415 and #1548. Row I-11 ofdocs/requirements/roster-loss-prevention.mdneeded no change, because the document declares its line anchors read atc1b9de8and all of them resolve there.Verification
Black-box verification of all 16 acceptance criteria (AC1–AC8 of #1535's ratified scope, AC9–AC16 of #1625): Run 5 —
PASS·Cardinality: 88 executed / 16 ACs·Rejected probes: 0· package.tmp/verify-alexey-pelykh-sessiometer-issue-1535-package.md, block## Run 5 — 2026-11-03T13:48:17Z(a local file in the maintainer's checkout). It gradeda5dca2ab5ca4d39d5dd4ba0af7c5f1317594477d(treef22e05dec48170a7902676c37043bfc52f2e5e40), and the verifier recorded that identity before its first probe and after its last. Run 4 (2026-11-03T12:32:57Z), on the same tree, readFAILon ten probes. The verifier's return attributes each of those failures to its own instrument, names a sibling probe that shows the criterion holds, and found no defect in the four files. Run 5 is the re-run that return asked for. Runs 1 and 2 readPASSagainst earlier trees. Run 3 readFAILagainst the pre-polish widened tree, and polish fixed its one defect.a5dca2awas never pushed.312e11eis its rebase ontomainat3f05d39, and the rebase gave every commit a new SHA.git range-diff fd8640b..a5dca2a origin/main..HEADreads=for all three commits, so312e11ecarries the graded patches unchanged.Local gate run 2026-11-03T11:39:16Z–11:40:49Z on tree
dcd17b8, this branch's change merged ontob9df076, every step exit 0: thetestjob's five commands on rustc 1.96.0 (2472 passed, 0 failed, 18 ignored), themsrvjob's build and test on 1.87.0 (2472 passed), bothdenychecks, the fourdoc-gatesscripts and the three trailer guards. The pushed tree48952778differs fromdcd17b8only in the documentationmaingained sinceb9df076(c39c3caand3f05d39), and no Rust code reads those files. On it, at 14:14Z, the fourdoc-gatesscripts, the three trailer guards and bothdenychecks were re-run, all exit 0. Not run locally: theswift,panel-goldensandformulajobs, whose paths this PR does not touch, andcheck-ci-ok-needs.sh, becauseyqis not installed andci.ymlis unchanged.CI on
312e11e: run 41651806514,ci-oksuccess.test,msrv,deny,doc-gatesandgate-change-ackpassed;swift,panel-goldensandformulawere path-skipped.Not checked: Linux and Windows builds, since no CI job compiles for either; the macOS keychain read in the base-URL case, since the store probe used the plaintext credentials file.
Follow-ups
_CLAUDE_CODE_ASSUME_FIRST_PARTY_BASE_URLandCLAUDE_CODE_API_BASE_URL.scrub_seams(), which today protects only the seams listed in it by hand.ANTHROPIC_AUTH_TOKENis honoured unconditionally at 2.1.294. The ledger's removal table saysY9()writes that bearer only when neitherMenorco()holds. That sentence is kept unchanged here.From the original PR description (Stefano Benatti)
The continuation re-read the binary: at 2.1.294,
ANTHROPIC_AUTH_TOKENis honoured unconditionally in this build, and the chain the issue cited turned out to be the source-labelling order rather than the selection order, which the ledger section now records.🤖 Generated with Claude Code