Claude Code permissions and sandboxing: safe team defaults
How Claude Code permissions settings, permission modes and the sandbox work, with a team baseline for .claude/settings.json you can adapt and roll out.

When a team starts using Claude Code, the first week usually goes like this. People click "Yes, and don't ask again" a lot. A few engineers switch to a mode that stops asking altogether. And nobody has written down what the agent should never be allowed to do.
From my perspective, Claude Code permissions settings are one of the most underused safety tools a team has. They're just JSON, they live in the repository, and they turn "please be careful" into rules the tool actually enforces.
Today, we'll walk through how permissions, modes and the sandbox fit together, and the baseline I'd start a team with.
How Claude Code Permissions Work
By default, Claude Code asks before it acts. According to Anthropic's permissions docs, reads inside your working directory don't need approval, while shell commands (apart from a built-in set of read-only ones), file edits, web fetches and web searches do.
You shape that behavior with three kinds of rules:
- allow runs matching actions without asking
- ask always prompts, even if something else would allow it
- deny blocks the action outright
The order matters. Rules are evaluated as deny, then ask, then allow, and the first match wins. A broad deny like Bash(aws *) blocks every matching call, even one that also matches a narrower allow rule. You can't carve an exception out of a deny.
Deny first, ask for anything risky, allow only what's routine. That order is the whole design.
Know the Permission Modes
Modes change how much Claude Code asks. The ones your team will meet:
| Mode | What it does |
|---|---|
default (Manual) |
Prompts on first use of each tool |
acceptEdits |
Auto-accepts file edits and common filesystem commands in the working directory |
plan |
Explores and reads, but doesn't edit your source files |
auto |
Runs without routine prompts; a background classifier checks actions first |
dontAsk |
Auto-denies anything that would prompt, except pre-approved tools |
bypassPermissions |
Skips permission prompts, except for a short list of actions no mode auto-approves |
For most day-to-day work, Manual and acceptEdits are the sensible defaults. Plan mode is great for "look around and propose an approach" before any code changes. bypassPermissions is the one to be deliberate about. If you want it off the table, the docs describe setting permissions.disableBypassPermissionsMode (and permissions.disableAutoMode, if you want that too) to "disable", ideally in managed settings where users can't override it.
A Baseline .claude/settings.json
Project settings live in .claude/settings.json, are committed to the repository, and apply to everyone who works in it. Personal tweaks go in .claude/settings.local.json instead.
Here's a starting point. Adjust the commands to your stack:
{
"permissions": {
"allow": [
"Bash(npm run test *)",
"Bash(npm run lint *)",
"Bash(git status)",
"Bash(git diff *)"
],
"ask": [
"Bash(git push *)",
"Bash(npm install *)"
],
"deny": [
"Read(./.env)",
"Read(./.env.*)",
"Read(./secrets/**)",
"Bash(curl *)",
"Bash(wget *)"
]
}
}
What this does, in plain words: routine checks run without interruptions, anything that publishes code or adds dependencies needs a human, and the agent can't read your environment files or pull arbitrary things from the internet with curl.
One nice safety detail: allow rules in a project's .claude/settings.json only take effect after a developer accepts the workspace trust dialog, which lists what the folder would grant. deny and ask rules apply right away, since they only restrict.
Understand What Rules Don't Cover
Here's the truth: permission rules are a strong first layer, but they aren't a wall. The docs are refreshingly direct about the gaps, and your team should know them.
- Bash rules match the command as written. A deny on
Bash(curl *)doesn't match/usr/bin/curlorsh -c 'curl ...'. - Read deny rules cover Claude's file tools and the file commands it recognizes, like
catorhead. They don't stop a Python or Node script that opens files itself. - A
.claudeignorefile has no effect. If you have one, move its entries intoReaddeny rules.
That's why the docs point to the sandbox when a restriction really has to hold.
Rules shape what the agent tries. The sandbox decides what's actually possible.
Turn On the Sandbox
Claude Code's sandbox is an OS-enforced boundary around the shell commands Claude runs and the processes they start. It's off by default. You can enable it per session with /sandbox, or in settings.
What it gives you:
- Filesystem writes limited to the working directory, a temp directory and directories you add.
- Network access only through a proxy that checks each hostname against
network.allowedDomains, which starts empty.
Two things to configure on purpose. First, reads are broad by default and include credential files like ~/.ssh and ~/.aws/credentials, so add those to filesystem.denyRead. Second, set failIfUnavailable so the sandbox doesn't quietly fall back to running commands unsandboxed.
{
"sandbox": {
"enabled": true,
"failIfUnavailable": true,
"filesystem": {
"denyRead": ["~/.ssh", "~/.aws"]
},
"network": {
"allowedDomains": ["github.com", "*.npmjs.org"]
}
}
}
Platform support matters for a mixed team. macOS uses Seatbelt, which is built in. Linux and WSL2 use bubblewrap, plus socat for the network relay. On native Windows, Claude Code runs commands unsandboxed, so Windows users should work in WSL2.
The sandbox also has limits worth knowing: Claude's own Read, Edit and WebFetch tools, hooks and local MCP servers run outside it. So you still want the permission rules. The two layers work together.
If you want a quick read on where your team stands across security and the rest of your AI rollout, the free readiness assessment takes about three minutes.
Roll It Out to the Team
A few habits make this stick:
- Commit the baseline in
.claude/settings.jsonand review changes to it like code. - Use managed settings for the non-negotiables. Managed settings can't be overridden by user or project settings, and
allowManagedPermissionRulesOnlymakes them the only source of permission rules if you need that level of control. - Run agents away from production. No production credentials on machines where agents run, sandbox or not.
- Revisit the allow list monthly. "Yes, and don't ask again" approvals pile up in local settings. Every so often, look at what people keep approving and decide whether it belongs in the shared file.
Conclusion
Claude Code gives you real controls: deny, ask and allow rules, modes you can restrict, and an OS-level sandbox. The teams that get the most from agents are usually the ones that set these up early, so engineers can move fast without wondering what the agent might touch.
So, whether you're the first person on your team using Claude Code or you're rolling it out to everyone, start with a committed baseline, turn the sandbox on, and lock the few things that should never change.
I hope you found this helpful. If you'd rather start from tested settings than a blank file, there are ready-to-use Claude Code permission and sandbox settings in the AI-Assisted Development Kit.
Trust the agent with the routine. Keep the risky decisions with people.