What Claude Code's sandbox really stops
Claude Code has two separate controls. Permission rules decide which tool calls Claude may make, and they match what Claude asks to do: a deny rule on Bash(aws *) stops that command text, not every way to run aws. The sandbox is enforced by the operating system, but it covers shell commands only and is off by default. Anthropic calls them "complementary security layers" and advises using both. Neither covers every process Claude Code starts. A boundary outside the agent covers that gap: a container, a VM, Anthropic's sandbox runtime, or Tego.
For the bigger picture, read AI agent security on Linux. We make Tego; every claim about Claude Code below links Anthropic's own docs, read on 6 November 2026.
What do permission rules stop?
Rules are allow, ask or deny, and "Rules are evaluated in order: deny, then ask, then allow." They apply to Bash, Read, Edit, WebFetch, MCP tools and almost every other tool (Configure permissions).
What they do not stop, in Anthropic's words:
- Other forms of a command. A Bash rule "doesn't match the same program invoked in a different form, so a deny or ask rule covers the invocation Claude usually produces and isn't a security boundary around the program."
- Files read by a program. Read and Edit deny rules cover Claude's file tools and commands such as
catandsed, but not "arbitrary subprocesses that read or write files indirectly, like a Python or Node script that opens files itself."
For that, the same page says: "For OS-level enforcement that blocks all processes from accessing a path, enable the sandbox."
What do the permission modes change?
| Mode | What it does, per Anthropic's docs |
|---|---|
default (called Manual in the CLI) |
Reads run without asking; most actions that edit files, run shell commands or reach the network prompt you first |
acceptEdits |
Runs "Reads, file edits, and common filesystem commands (mkdir, touch, mv, cp, etc.)" without asking |
plan |
"Claude reads files, runs shell commands to explore, and writes a plan, but does not edit your source." |
auto |
"A separate classifier model reviews actions before they run." |
dontAsk |
Claude Code "auto-denies every tool call that would otherwise prompt you", though a mod you installed can still approve some of those calls |
bypassPermissions |
"disables permission prompts and safety checks so tool calls execute immediately", except for a few actions no mode auto-approves |
With Claude Code v2.1.283 or later, auto is the built-in starting mode for interactive terminal and VS Code sessions.
Starting with --dangerously-skip-permissions puts the session in bypassPermissions mode (permission modes). Anthropic says the mode lets tool calls run without prompts or safety checks "including writes to protected paths", a list that includes .git and .claude, and an administrator can turn the mode off by setting permissions.disableBypassPermissionsMode to "disable" in managed settings.
What does the sandbox stop?
The sandboxed Bash tool restricts "shell commands' filesystem and network access" at the OS level, and applies to Bash, PowerShell and Monitor commands and their child processes (Configure permissions). On Linux it uses bubblewrap. Its own guide adds the limits (Sandboxing):
- It is off by default; you turn it on with
/sandbox. - Claude's file tools, MCP servers and hooks run outside it.
- By default, commands can read across most of the machine, credential files included, unless you deny them.
- If it cannot start, commands run unsandboxed unless
sandbox.failIfUnavailableis set.
Anthropic's point about using both is that "sandbox restrictions still apply even if a prompt injection bypasses Claude's decision-making."
What does neither one cover?
Put the two together and some things are still outside an OS boundary: the built-in file and web tools (held only by permission rules, which match paths Claude names), and the other processes Claude Code starts, such as hooks, local MCP servers and LSP servers. Commands that match excludedCommands, and retries you approve outside the sandbox, run unsandboxed too. Anthropic's sandbox runtime wraps the whole Claude Code process, file tools, MCP servers and hooks included, but Anthropic calls it "a beta research preview" (Choose a sandbox environment). A container or VM separates the whole environment.
What does a boundary outside Claude Code add?
Tego runs the whole Claude Code process tree under a contract: the file tools, the hooks and the MCP servers it starts, as well as its shell commands. The Linux kernel and Tego's supervisor refuse what the contract rules out. Writes to paths the contract does not list are refused, with or without an fs: section. Programs and network hosts are limited only as far as the contract's exec: and net: sections say: with no exec: section every program runs, and with no net: section every IP destination is reachable. Tego's built-in deny_read list keeps ~/.ssh, ~/.aws and the project's .env files out of reach unless you turn it off. A prompt that talks Claude into a different command still meets the same contract, and each run leaves a hash-chained record.
What it does not do: run outside Linux (on macOS or Windows, run it inside a Linux VM), hide the machine (the agent reads any path not in deny_read), close a host you allowed, or stop what an allowed program does inside its own memory. Do not count on running both sandboxes at once: inside a Tego run held by a contract, bubblewrap cannot start today. Run Claude Code and Codex under Tego has the details.
Is bypassPermissions reasonable under Tego?
Not as a blanket yes. Anthropic's advice is to "Always run --dangerously-skip-permissions sessions inside a container, a VM, or the sandbox runtime" (Choose a sandbox environment). Tego is none of those. What Tego changes is what an unprompted Claude can do: write only where the contract lists, and run only the programs and reach only the hosts its exec: and net: sections allow, with those refusals recorded. If you skip permissions, keep the contract tight, keep secrets out of reach, and run inside a VM for an untrusted repository; Tego runs inside the VM too.
To set it up step by step, read Lock down Claude Code on Linux. For Codex, read Run Codex CLI on Linux under rules it cannot turn off.
Sources (7 links)
Read on 6 November 2026.
- Anthropic: Configure permissions, Permission modes, Sandboxing, Choose a sandbox environment, sandbox-runtime.
- Tego: README, contract semantics.
Read next
Lock down Claude Code on Linux in seven steps
Run Claude Code under Tego, step by step.
Your agent can ignore CLAUDE.md
A rule your agent can read isn't a rule it must follow.
Five ways to sandbox an AI agent
Sandboxes, containers, VMs and Tego, compared.