Bash Permission Rule vs Sandbox
People think a Bash deny rule is a wall around a program. It is a check on the text Claude writes. Bash(rm *) stops rm, but not /bin/rm or sh -c 'rm'. The sandbox works lower down. It limits which files and hosts any command can reach, however it is spelled. Use rules to cut prompts, and the sandbox for a hard limit.
Bash Permission Rule
A rule like Bash(npm run *) that covers shell commands.
A Bash permission rule matches the shell commands Claude wants to run. It is written as Bash and the command, such as Bash(npm run *). A star stands for any text. A bare Bash rule covers every command. The rule matches the text Claude writes, so the same program called another way can slip past it.
Claude Code Sandbox
A wall that keeps Claude's shell commands in set folders and sites.
The Claude Code sandbox runs the shell commands Claude starts inside a wall set by your computer's system. You choose up front which folders they may write to and which sites they may reach. Inside that wall, commands can run without asking, since they cannot reach anything else. It is off at first, and you turn it on with /sandbox. It is a separate layer from permission rules, and the two work together.
In one line
- Bash Permission Rule
- A rule like Bash(npm run *) that covers shell commands.
- Claude Code Sandbox
- A wall that keeps Claude's shell commands in set folders and sites.