fix(#5832): strip OIDC credentials from user-controlled environments - #5837
Conversation
Prevent user-authored pre/post scripts, validation commands, and LLM
sessions from minting their own tokens by removing OIDC credential
env vars (ACTIONS_ID_TOKEN_REQUEST_URL, ACTIONS_ID_TOKEN_REQUEST_TOKEN,
FULLSEND_GCP_OIDC_URL, FULLSEND_GCP_OIDC_AUTH_FILE) from all
user-controlled and sandbox-visible contexts.
The parent harness process retains OIDC credentials for
mintAgentToken and background token refresh.
Controls implemented:
- childScriptEnv: strips OIDC vars from pre/post script environments
- shellSafeExpandEnv: refuses OIDC vars in host_files expansion
- reservedSandboxKeys: blocks OIDC vars from env.sandbox injection
- Harness expander/lookup: refuses OIDC vars in ${VAR} expansion
- Preflight check: uses childScriptEnv instead of raw os.Environ()
- Validation scripts: scrubs OIDC vars from os.Environ()
Closes #5832
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
🤖 Finished Review · ✅ Success · Started 12:12 PM UTC · Completed 12:28 PM UTC |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
ReviewFindingsLow
Previous runReviewFindingsMedium
Low
Previous run (2)ReviewFindingsMedium
Low
Labels: PR is a security hardening fix affecting the harness, sandbox, and mint components — matches the linked issue's component labels |
|
/fs-fix |
|
🤖 Finished Fix · ✅ Success · Started 12:58 PM UTC · Completed 1:06 PM UTC |
- Close incomplete scrubbing path: apply stripOIDCEnv to the full composed env slice (os.Environ + validationEnv) so OIDC keys from h.RunnerEnv cannot survive scrubbing in validation and post-loop sweep contexts. - Eliminate DRY violation: replace hardcoded OIDC entries in reservedSandboxKeys with init() that merges from oidcDenyKeys, so future additions automatically block sandbox injection. - Document intentional behavioral divergence between expander (silent empty expansion) and lookup (fail-closed validation) for OIDC keys. - Rename scrubOIDCEnv → stripOIDCEnv for naming consistency with comments and PR title. Addresses review feedback on #5837
🔧 Fix agent — iteration 1 (human-triggered)Addressed all 4 review findings: closed the incomplete scrubbing path for validation envs, eliminated the DRY violation between oidcDenyKeys and reservedSandboxKeys via init(), documented the intentional expander/lookup behavioral divergence, and renamed scrubOIDCEnv to stripOIDCEnv for naming consistency. Fixed (4):
Tests: passedNext steps:
|
|
🤖 Finished Review · ✅ Success · Started 1:07 PM UTC · Completed 1:22 PM UTC |
|
/fs-fix the following:
|
|
🤖 Finished Fix · ✅ Success · Started 10:04 AM UTC · Completed 10:13 AM UTC |
Replace os.ExpandEnv(hf.Src) in host_files src path expansion with a new safeExpandEnv helper that consults oidcDenyKeys, closing the last expansion site that could leak OIDC credential paths into the sandbox. Also add a MAINTENANCE doc comment to oidcDenyKeys noting the prefix convention (ACTIONS_ID_TOKEN_ / FULLSEND_GCP_OIDC_) so future credential vars are added to the deny list. Addresses review feedback on #5837
🔧 Fix agent — iteration 2 (human-triggered)Addressed 2 of 3 review findings. Fixed the host_files src expansion gap by creating a safeExpandEnv helper that consults oidcDenyKeys. Added maintenance documentation to oidcDenyKeys noting prefix conventions. Disagreed with finding 2 (behavioral-inconsistency) as the different semantics are intentional and well-documented. Fixed (2):
Disagreed (1):
Tests: passed Decision points
Next steps:
|
|
🤖 Finished Review · ✅ Success · Started 10:14 AM UTC · Completed 10:31 AM UTC |
|
🤖 Finished Retro · ✅ Success · Started 11:53 AM UTC · Completed 12:09 PM UTC |
Retro: PR #5837 — strip OIDC credentials from user-controlled environmentsTimeline
Workflow qualityReview quality was excellent. The review agent produced 9/9 true positives and 0 false positives across 3 iterations. Its two most impactful findings were genuine security gaps: (1) OIDC keys from Fix agent quality was high. Both fix commits were well-scoped, correctly targeted, and included tests. The fix agent's disagreement with the Token waste: minimal. Concurrency deduplication worked correctly. One early review run was cancelled by Functional test flake: Test Evidence for existing issues (not filing new proposals)
No new proposalsAll candidate improvements identified in this retro are already tracked by existing open issues. The workflow performed well — the review agent caught real security gaps, the fix agent resolved them correctly, and the pipeline converged in 3 iterations with no wasted work. |
Pre-scripts can no longer mint their own tokens since #5837 stripped the OIDC mint credentials from the pre-script environment (#5832, enforcing ADR 0073). Record it as a consequence annotation so the open forge-call ownership question reads as token possession, not minting capability. Assisted-by: Claude Signed-off-by: Wayne Sun <gsun@redhat.com>
Summary
Strip OIDC credential env vars from all user-controlled and sandbox-visible contexts to prevent user-authored scripts and LLM sessions from minting their own tokens. The parent harness process retains credentials for
mintAgentTokenand OIDC token refresh.Changes
oidcDenyKeysdenylist for 4 OIDC env vars (ACTIONS_ID_TOKEN_REQUEST_URL,ACTIONS_ID_TOKEN_REQUEST_TOKEN,FULLSEND_GCP_OIDC_URL,FULLSEND_GCP_OIDC_AUTH_FILE)childScriptEnv: strip OIDC vars from pre/post script environmentsshellSafeExpandEnv: refuse OIDC vars in host_files${VAR}expansionreservedSandboxKeys: block OIDC vars fromenv.sandboxinjectionexpander/lookupclosures: refuse OIDC vars in runner_env/env expansionchildScriptEnvinstead of rawos.Environ()scrubOIDCEnvhelper to filteros.Environ()Testing
childScriptEnvstripping OIDC vars (from process env and RunnerEnv)shellSafeExpandEnvrefusing OIDC varsreservedSandboxKeysincluding OIDC varsbuildSandboxEnvLinesrejecting OIDC varsscrubOIDCEnvhelperoidcDenyKeyscompletenesschildScriptEnv,shellSafeExpandEnv, andbuildSandboxEnvLinestests passgo vet ./internal/cli/...passesCloses #5832
Post-script verification
agent/5832-block-mint-oidc-leak)93bd394a743d4db23c088b016423657c18f85058..HEAD)