Repository navigation
Keep gh's token out of the sandbox - #1898
Merged
Merged
Conversation
The local settings template granted sandboxed Bash a read of ~/.config/gh/, so any unprompted sandboxed command could copy the gh token in hosts.yml. Nothing sandboxed needs it: `gh *` is in sandbox.excludedCommands and reads its own credentials outside the sandbox. The template and the sandbox-lint baseline drop the grant, and sandbox-lint now refuses ~/.config/gh in allowRead, as it does ~/.config/apache-magpie. The setup docs and the spec say why, and the isolated-setup fingerprint moves so installed setups are told to update. Generated-by: Claude Code (Opus 5.5)
potiuk
enabled auto-merge (squash)
October 29, 2026 10:13
potiuk
disabled auto-merge
October 29, 2026 18:10
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.
Summary
~/.config/gh/, so any unprompted sandboxed command could read gh's token inhosts.ymland send it to an allowed host.Nothing sandboxed needs the file:
gh *is insandbox.excludedCommands, soghruns outside the sandbox and reads its own credentials there.tools/sandbox-lint/expected.jsonbaseline drop the grant, andsandbox-lintnow refuses~/.config/ghinallowRead, the same hard invariant~/.config/apache-magpiehas.secure-agent-setup.md,secure-agent-internals.mdand the agent-isolation spec replace the "bash can read it, the agent can't" split with the actual model: denied to both, used only by the excludedgh.The isolated-setup fingerprint moves, so
setup-isolated-setup-updatetells installed setups to refresh.Type of change
.claude/skills/<name>/) — eval fixtures updated belowtools/<system>/*.md)tools/*/withpyproject.toml)docs/,README.md,CONTRIBUTING.md)projects/_template/)prek, workflows, validators)Test plan
prek run --all-filespasses (--skip workspace-pytest, thenworkspace-pytestfor the changed members)uv run pytest/ruff check/mypypasses —tools/sandbox-lint(newallowReadcases for~/.config/ghand~/.config/gh/),tools/agent-isolation/tests/test_sandbox_add_project_root.pytest -r ~/.config/gh/hosts.ymlfail inside the sandbox while plainghcommands keep working.RFC-AI-0004 compliance
<PROJECT>,<tracker>,<upstream>,<security-list>) used in all skill / tool prose (thecheck-placeholdersprek hook is the mechanical gate)Linked issues
None.
Notes for reviewers (optional)
ghinside a pipe or$(…), or a sandboxedgit pushover HTTPS through gh's credential helper, can no longer read the token.Both already fail inside the sandbox on TLS verification, so the documented route (
ghas a plain command,git pushwith an approved bypass) is unchanged.~/.config/gh/fromsandbox.filesystem.allowRead;complete-upgradestops proposing to add it.Generative AI tooling was used: Claude Code (Opus 5.5).
🤖 Generated with Claude Code