Repository navigation
Hide host credential files from sandboxed harness shells - #67
Merged
Merged
Conversation
Harness shells read `/`: the outer bwrap ro-binds it and the Codex math-worker profile grants `/`=read. Both masked only /run, /tmp and hidden roots, so a model-run shell could read ~/.codex/auth.json, ~/.config, ~/.claude, ~/.ssh and similar stores. hostCredentialRoots() resolves a fixed list of credential stores under the user's home to real paths, also masks the real targets of symlinked entries, masks a store entry by entry when it holds a path the launch needs, and never masks an ancestor of a home. prepareHarnessProcess adds these roots to its masks; mathWorkerPermissionConfig marks them `none`. Codex keeps CODEX_HOME/tmp visible because its apply_patch helper lives there and is on the shell PATH. Toolchains under home stay readable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Harness shells can read
/. The outer bwrap (Claude Code, OpenCode, generic cli, Lean health check, isolated Codex) uses--ro-bind / /, and the Codex math-worker permission profile grants/= read. Both masked only/run,/tmpand hidden roots. A model-run shell could therefore read host credential files such as~/.codex/auth.json,~/.config/*,~/.claude,~/.sshand~/.claude.json.Change
HOST_CREDENTIAL_PATHSandhostCredentialRoots(keep, homes)insrc/runtime/harnessProcess.ts:os.homedir()and the passwd home) to their real paths./or an ancestor of a home.prepareHarnessProcessadds these roots to its bwrap masks.mathWorkerPermissionConfigmarks themnone.<CODEX_HOME>/tmpvisible because itsapply_patcharg0 helper lives there and is on the shell PATH. The solver's default CODEX_HOME is under~/.config.~/.codex/packages,~/.elan,~/.local/node*, and~/.cacheexcept the HuggingFace token.Verification
~/.config, and toolchains that must stay visible.tsc --noEmitandbun run buildpass.test -rand directory listing only:codex sandboxwith the math-worker profile.lean --versionruns.~/.config,apply_patchstill resolves while the profile'sauth.jsonis denied.formalizationReviewCliandputnamBenchalso fail on maine676474b.codexSessionFileWatchfails only under full-suite load and passes alone.Not covered
Credentials stored outside the home, or under file names that are not in the list.
🤖 Generated with Claude Code