Skip to content

Tighten Claude Code sandbox write allowlist - #83

Merged
technicalpickles merged 1 commit into
mainfrom
claude-allowlist-tighten
Oct 21, 2026
Merged

technicalpickles merged 1 commit into
mainfrom
claude-allowlist-tighten

Conversation

@technicalpickles

Copy link
Copy Markdown
Owner

Summary

Claude Code's sandbox write allowlist (generated from claude/stacks/*.jsonc) had grown by accretion, and a handful of entries let a sandboxed write run code outside the sandbox later. This trims those:

  • ~/.config/mise and ~/.config/gh are no longer writable. mise config sets PATH and can name tasks and hooks, and gh aliases can be !shell commands.
  • ~/.cargo and ~/go narrow to their cache dirs, so ~/.cargo/bin and ~/go/bin (both on PATH) are read-only. A new ~/.cargo/config.toml could also name a rustc-wrapper.
  • Rc locations that don't exist yet are dropped: .yarnrc, .yarnrc.yml, ~/.config/{yarn,npm,pnpm,go,uv}, Library/Preferences/pnpm. Each could be created to name code that runs on a later yarn, pnpm or go call. ~/.yarn narrows to ~/.yarn/berry, where yarn 4 keeps its global cache.

Each change has a one-line comment saying why. The cost: cargo install and go install now have to run outside the sandbox.

Test plan

  • Nothing takes effect until this merges and ./claudeconfig.sh runs outside the sandbox (it writes ~/.claude/settings.json). Afterwards, jq '.sandbox.filesystem.allowWrite' ~/.claude/settings.json should no longer list the dropped entries.
  • I couldn't run the repo's typecheck here (no node_modules in the new worktree); prettier passes on the stacks.

Follow-up work

The audit found more that needs a decision first: mise trust state under ~/.local/state/mise, ~/.bundle/config credentials, ~/.colima, and the dotslash cache. Reads are allow-default in Claude Code's sandbox, so credentials stay readable whatever this list says.

🤖 Generated with Claude Code

Stop granting write to places a sandboxed write can run outside the
sandbox later:

- ~/.config/mise (config.toml and conf.d set PATH, tasks and hooks)
- ~/.config/gh (config.yml aliases can be `!shell` commands)
- ~/.cargo and ~/go narrowed to their cache dirs, so ~/.cargo/bin and
  ~/go/bin (both on PATH) are no longer writable
- absent rc locations that can name code to run: .yarnrc, .yarnrc.yml,
  ~/.config/{yarn,npm,pnpm,go,uv}, Library/Preferences/pnpm; ~/.yarn
  narrows to ~/.yarn/berry (the global cache)

cargo install and go install now have to run outside the sandbox.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@technicalpickles
technicalpickles marked this pull request as ready for review October 21, 2026 13:35
@technicalpickles
technicalpickles merged commit 18753af into main Oct 21, 2026
1 check passed
@technicalpickles
technicalpickles deleted the claude-allowlist-tighten branch October 21, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant