When Claude Code runs a shell command for you, that command runs as you. It can write where you can write and reach the network you can reach.
Claude Code has a sandbox that changes this. It is off by default. This post covers what it limits, what it leaves alone, and how to turn it on. Every claim is from Anthropic's sandboxing page, read on November 14, 2026.
What it limits
A shell command inside the sandbox
Writing files. By default a sandboxed command can write to "the working directory, a per-user temp directory, and directories you've added." Everywhere else is refused.
The network. A sandboxed command has "no direct route out." Its connections go through a proxy on your machine "that checks each host against your allowed domains, which start empty." So until you allow a domain, a command cannot call out.
Reading files is the surprise. By default a sandboxed command can still read "most of the machine, including credential files such as ~/.ssh and ~/.aws/credentials." The sandbox stops a command from changing your machine or sending data out. It does not, on its own, stop a command from reading your keys. You restrict reads yourself, with the filesystem.denyRead setting.
What it does not cover
The docs are direct about this: "The sandbox covers shell commands only. Claude's file tools, MCP servers, and hooks run outside it."
So the sandbox is one layer. Permission rules are the other, and they cover the file tools. You want both.
How to turn it on
Type /sandbox in Claude Code, or set it in a settings file such as ~/.claude/settings.json:
{
"sandbox": { "enabled": true }
}
What you need depends on your system:
- macOS: nothing extra. It "uses the built-in Seatbelt framework."
- Linux and WSL2: install bubblewrap and socat first. On Ubuntu or Debian that is
sudo apt-get install bubblewrap socat. - Native Windows: not supported. There, "Claude Code runs commands unsandboxed." WSL1 is not supported either.
One setting worth knowing: what happens when the sandbox cannot start
If your platform is not supported, or a dependency is missing, the default is quiet: "Claude Code runs commands without sandboxing." You may believe you are protected when you are not.
Set sandbox.failIfUnavailable to true and Claude Code will not fall back to running without the sandbox. Our suggestion: turn this on anywhere you are counting on the sandbox, such as a shared team setup.
Does it still ask for approval?
That depends on the mode you pick.
- Regular mode: "All Bash commands go through the regular permission flow, even when sandboxed." You are asked as before, and the sandbox is an extra limit underneath.
- Auto-allow mode: "Claude Code approves a command automatically, with no prompt, when the command runs inside the sandbox." This is the mode that removes the constant approvals.
Your rules still hold in auto-allow mode. "A command in a form that a Bash deny rule matches is still blocked." And an ask rule for a specific command, such as Bash(git push *), still makes it stop and ask.
The ways out, and what they cost
Some tools do not work inside a sandbox. The docs describe three ways a command can end up outside it:
- A retry. If a command fails inside the sandbox, Claude may ask to run it again without one. The docs call this "an escape hatch for commands that fail inside the sandbox, such as tools that are incompatible with it."
- An excluded command. You can list commands in
excludedCommands. The cost is stated plainly: "An excluded command runs with your full access." - Commands you type yourself at the
!prompt usually run unsandboxed.
Each one is a hole you chose. Keep the excluded list short, and read the retry prompt before you approve it.
What to do this week
- Turn the sandbox on with
/sandbox. - Add a
filesystem.denyReadentry for your key folders, since reads are open by default. - Allow only the domains your project needs.
- Keep your deny rules. They still apply, and they cover what the sandbox does not.
This is one item on a longer list. The rest is in a pre-flight checklist for a new Claude Code project.
About this post, and the tool that prompted it
We ran a setup check on our own repository and found the sandbox off, which is what prompted this post. That check is JQ Groundcrew, a free tool. In a project folder, run npx jq-groundcrew. It runs on your machine and sends nothing anywhere.
Anthropic's documentation can change. If this post and the sandboxing page disagree, the page is right. We are not affiliated with Anthropic.