Claude Code permissions, allowlists and sandboxing

Claude Code controls what it runs and touches through permission modes, allow and deny rules and an OS-level Bash sandbox, but the sandbox is off by default and does not cover every tool.

On this page

Can Claude Code's permissions and sandbox limit what developers' agents run and read?

Claude Code gives a platform or security lead three local controls in its standard product: permission modes, allow and deny rules, and an OS-level Bash sandbox. Admins can make the sandbox mandatory through managed settings, but the sandbox covers Bash commands only and is off by default, so it protects a laptop only after someone turns it on. The team must decide which permission mode developers start in, which commands and paths are allowed or denied, whether the sandbox is required, and which network hosts Bash may reach. The gaps sit outside Bash. The built-in Read, Edit, Write, WebFetch and WebSearch tools, hooks, local MCP servers and apiKeyHelper are not sandboxed, so they follow permission rules or run with full access. The supplied facts do not tie these controls to one plan, so confirm with Anthropic which editions let admins enforce the sandbox and permission settings centrally before you write the rollout policy.

The Bash sandbox is enforced by the operating system, using Seatbelt on macOS and bubblewrap on Linux and WSL2, and it is built on the open source @anthropic-ai/sandbox-runtime package. Sandboxed commands can write only to the working directory, a per-user temp directory and any added directories. Reads are the weak point: by default they can reach most of the machine, including ~/.ssh and ~/.aws/credentials, unless denyRead rules are set. Outbound traffic from sandboxed commands passes through a local proxy that checks each hostname against allowedDomains, which starts empty, and it refuses hostnames that resolve only to loopback or link-local addresses such as 169.254.169.254. Native Windows runs commands unsandboxed, so developers on that platform need a separate control. Review the sandboxing documentation for the exact keys before you write them into policy.

Make these decisions in writing before rollout. Set the sandbox as mandatory with failIfUnavailable so Claude Code exits instead of running commands unsandboxed, and set allowUnsandboxedCommands to false so the dangerouslyDisableSandbox retry is disabled. Then choose a default permission mode. Manual mode starts read-only and asks before edits, tests or commands outside a built-in read-only set, while auto mode, the built-in starting mode for interactive terminal and VS Code sessions, uses a separate classifier model to block actions it judges unsafe. Organizations can turn auto mode off. Test the configuration on a managed machine by attempting to read ~/.aws/credentials and by requesting a host missing from allowedDomains. Confirm with Anthropic which plans let admins push these settings centrally and whether the same keys apply to the IDE and desktop surfaces.

Permissions and sandbox support by control

This table compares each Claude Code permission and sandbox control by its status: built in, off by default, admin-enforced or not covered. Read each row as a question to answer for your own rollout, since the status tells you whether a control protects you without action or depends on configuration. Plan availability for each control still needs confirmation with Anthropic before you approve the tool.

ControlStatusWhat to confirm or do
Permission modes (auto mode)Built inAuto mode is the starting mode for interactive terminal and VS Code sessions, with a classifier that blocks actions it judges unsafe; confirm whether your organization can turn it off
Manual modeBuilt inStarts read-only and asks before edits, tests or commands, except a built-in set of read-only commands such as ls, cat and git status
Allow and deny rulesAdmin-enforcedSet rules that govern built-in tools and commands; confirm which rules managed settings can lock so developers cannot override them
Working directory boundaryBuilt inSandboxed commands write only to the working directory, a per-user temp directory and added directories; reads are not limited by this boundary
Bash sandbox (Seatbelt and bubblewrap)Off by defaultUses Seatbelt on macOS and bubblewrap on Linux and WSL2; must be enabled, and confirm the rollout method for every developer machine
Sandbox read isolation (denyRead)Off by defaultWithout denyRead rules, sandboxed commands can read most of the machine, including ~/.ssh and ~/.aws/credentials
Sandbox network allowlist (allowedDomains)Off by defaultThe allowlist is empty by default; each hostname is checked by a local proxy, and loopback or link-local hostnames such as 169.254.169.254 are refused
Mandatory sandbox (failIfUnavailable)Admin-enforcedSet through managed settings so Claude Code exits instead of running unsandboxed; confirm the setting works on your managed macOS and Linux fleet
Blocking the sandbox retry (allowUnsandboxedCommands set to false)Admin-enforcedDisables the dangerouslyDisableSandbox retry through managed settings; confirm it applies to all developer and CI environments
Native WindowsNot coveredNative Windows runs commands unsandboxed; use WSL2 for sandboxed Bash, and confirm this with your Windows engineering standard
Built-in Read, Edit, Write, WebFetch and WebSearch toolsNot coveredThese follow permission rules instead of the sandbox; hooks, local MCP servers and apiKeyHelper also run outside it

How permission modes and the Bash sandbox divide the work

Claude Code relies on two separate layers, and a reviewer should check each one on its own terms. The first is the permission mode. Auto mode is the built-in starting mode for interactive terminal and VS Code sessions, and a separate classifier model reviews each action and blocks those it judges unsafe. Organizations can turn auto mode off. Manual mode is the stricter choice: Claude Code starts read-only and asks before editing files, running tests or executing commands, except for a built-in set of read-only commands such as ls, cat and git status. The second layer is the Bash sandbox, which applies operating system controls to shell commands. It uses Seatbelt on macOS and bubblewrap on Linux and WSL2, and it is built on the open source @anthropic-ai/sandbox-runtime package. The sandbox is off by default, and native Windows runs commands unsandboxed, so a Windows fleet needs its own decision. Confirm the current mode and sandbox state on a sample developer machine before approving a rollout.

The sandbox limits writes more tightly than reads. Sandboxed commands can write only to the working directory, a per-user temp directory and any added directories. Reads are much broader by default: a sandboxed command can read most of the machine, including ~/.ssh and ~/.aws/credentials, unless denyRead rules are set. A security team should therefore decide which credential paths must be denied and write those rules into managed settings, not rely on the defaults. Ask engineering which directories developers add to the workspace, because each added directory widens the write boundary.

Network access from sandboxed commands goes through a local proxy. The proxy checks each hostname against allowedDomains, which is empty by default, so the allowlist is the main control to define. The proxy also refuses hostnames that resolve only to loopback or link-local addresses, such as 169.254.169.254, which is the instance metadata address used by many cloud providers. That refusal blocks one common route to cloud credentials, but it does not replace an allowlist. Plan a review of every domain added to allowedDomains, and confirm with Anthropic's current sandboxing documentation how the proxy treats other destinations before relying on it for regulated data.

Decisions the organization must make before enabling the sandbox

Enabling the Claude Code Bash sandbox is not a single switch. Each setting below decides what a developer's agent can reach, what it can reach without asking, and what happens when the sandbox cannot start. Work through them together, because a permissive network list or an unsandboxed retry can undo a strict filesystem policy.

Choose the default permission mode

Auto mode is the built-in starting mode for interactive terminal and VS Code sessions. A separate classifier model reviews each action and blocks those it judges unsafe, so developers approve less often. Manual mode starts read-only and asks before edits, tests or commands, apart from a built-in set of read-only commands such as ls, cat and git status. Decide which mode developers receive, and confirm whether your managed settings can set it. Manual mode gives the most approval points, auto mode gives fewer.

Security page

Set the allowedDomains list

Sandboxed network traffic passes through a local proxy that checks each hostname against allowedDomains, and that list is empty by default. Every domain you add is reachable from any sandboxed command, so package registries and Git hosts need a deliberate entry. Decide which registries your developers install from and which Git hosts they push to. Hosts left off the list will cause installs and fetches to fail, so expect support requests during rollout.

Sandboxing docs

Add denyRead paths for credentials

By default, sandboxed commands can read most of the machine, including ~/.ssh and ~/.aws/credentials. The sandbox limits writes to the working directory, a per-user temp directory and added directories, but read access is broad unless you set denyRead rules. Decide which credential and secret locations must be blocked, such as SSH keys, cloud CLI profiles and token stores, and test that a sandboxed command cannot print them. Remember that this control applies only to Bash-launched commands.

Decide on unsandboxed retries

When a sandboxed command fails, Claude Code can retry it outside the sandbox through the dangerouslyDisableSandbox path. Setting allowUnsandboxedCommands to false in managed settings disables that retry, so a blocked command stays blocked. Expect more visible failures with this setting, because developers cannot route around a rule that is too strict. Decide whether your team accepts that friction, and document how a developer should request an exception.

Make the sandbox mandatory

The sandbox is off by default, so an unconfigured laptop runs commands without isolation. Managed settings can set failIfUnavailable, which makes Claude Code exit instead of running unsandboxed when the sandbox cannot start. Confirm that your endpoint management delivers this setting before enforcing it. Pair it with the unsandboxed-retry decision above, because both settings must be in place for the sandbox to be mandatory in practice.

Plan for native Windows

The Bash sandbox runs on Seatbelt for macOS and bubblewrap for Linux and WSL2. Native Windows runs commands unsandboxed. If your developers use Windows, decide whether they must work inside WSL2, whether they may use native Windows, or whether native Windows machines are excluded from Bash use. Check this with your endpoint team, because a Windows developer who meets no sandbox error may never know commands are running without isolation.

How the sandbox setup changes by operating system and team type

On macOS and on Linux or WSL2, the Bash sandbox is available, but it is off by default, so the setting has to be turned on and enforced through managed settings. On macOS the backend is Seatbelt, and on Linux and WSL2 it is bubblewrap. Both run on the open source @anthropic-ai/sandbox-runtime package, so the isolation model is similar across these two platforms even though the underlying mechanisms differ.

  • Backend: Seatbelt on macOS, bubblewrap on Linux and WSL2, both built on the same runtime package.
  • Default read scope: sandboxed commands can read most of the machine by default, including ~/.ssh and ~/.aws/credentials, until denyRead rules are added.
  • Write scope: writes are limited to the working directory, a per-user temp directory and any added directories.
  • Network allowlist: allowedDomains is empty by default, so every hostname must be added deliberately.
  • Mandatory mode: set failIfUnavailable and allowUnsandboxedCommands to false in managed settings.

Confirm on a sample machine of each OS image that the sandbox starts, that denyRead covers credential paths, and that the allowlist matches the hosts your build and test tools actually call.

Rollout order for permissions and sandboxing

This sequence moves a Claude Code rollout from knowing what version is installed to a sandbox that cannot be quietly bypassed, so that the permissions your reviewers approved are the ones developers actually run under. Each step closes with a check you can record as evidence.

  1. Inventory versions and install methods

    The platform or endpoint team lists every machine that runs Claude Code and records the installation method for each: the native installer or the npm package @anthropic-ai/claude-code. Users on standard auto-update receive security fixes automatically, while manual updaters must upgrade themselves, so the inventory should separate these two groups. The step is done when every developer machine appears in the list with a version and an update method, and the manual group has a named owner responsible for upgrades.

  2. Choose the default permission mode

    The security lead decides which permission mode developers start in. Auto mode is the built-in starting mode for interactive terminal and VS Code sessions, where a separate classifier model reviews actions and blocks ones it judges unsafe, and organizations can turn it off. Manual mode starts read-only and asks before edits, tests or commands, apart from a small built-in set of read-only commands. The step is done when the chosen default is written into the rollout policy, with the reason and whether auto mode is disabled.

  3. Enable the Bash sandbox with reviewed rules

    The engineering lead turns on the Bash sandbox, which is off by default, and reviews two lists before developers use it. The allowedDomains list is empty by default, so each hostname needed for builds or package installs must be approved by name. The denyRead list must be set deliberately, because sandboxed commands can otherwise read most of the machine, including ~/.ssh and ~/.aws/credentials. The step is done when both lists are signed off and a test session confirms that a blocked hostname and a denied credential path both fail. Note that native Windows runs commands unsandboxed.

  4. Make the sandbox mandatory through managed settings

    The administrator deploys managed settings to every machine so developers cannot opt out. Setting failIfUnavailable makes Claude Code exit rather than run unsandboxed when the sandbox cannot start. Confirm the exact managed-settings file location and delivery method for your fleet, such as MDM, against the current Claude Code documentation before rollout. The step is done when a test machine with the sandbox deliberately unavailable refuses to run commands, and the managed file is confirmed present on each managed endpoint.

  5. Restrict unsandboxed retries

    Claude Code can retry a failed command outside the sandbox using the dangerouslyDisableSandbox flag. The administrator sets allowUnsandboxedCommands to false in managed settings to disable that retry path. The security lead should record that this closes the retry route, while the other tools listed in the sandbox limits still need separate controls. The step is done when a test command that normally triggers a retry fails without running outside the sandbox, and the setting is recorded in the change log.

  6. Test with prompt-injection and credential-read scenarios

    The security team runs a scripted set of tests on a managed test machine, using a dummy repository and dummy credentials rather than real secrets. One scenario plants an instruction in a file or web page that asks the agent to read a credential path or send data to an unapproved host. Another attempts a read of a denied path and a write outside the working directory. The team also checks that the built-in Read, Edit, Write, WebFetch and WebSearch tools, hooks, local MCP servers and apiKeyHelper follow permission rules, since the sandbox does not cover them. The step is done when every scenario produces the expected block and the results are filed as evidence for the approval record.

  7. Monitor advisories and re-test after upgrades

    The security owner subscribes to Anthropic's published GitHub security advisories for the anthropics/claude-code repository and maps any listed affected versions against the inventory from the first step. After each upgrade, the team reruns the test scenarios on a managed machine before the new version is allowed onto the fleet. The step is done when a named owner receives advisory notices, a version check is documented for each release, and the test results are repeated and retained.

Decision path for a Claude Code Bash command

The diagram starts when Claude Code proposes a Bash command. The permission mode and allow and deny rules are checked first, then the command enters the Bash sandbox, where the write boundary, the read scope and the proxy hostname check apply. If the sandbox is unavailable, failIfUnavailable makes Claude Code exit rather than run the command unsandboxed. A retry with dangerouslyDisableSandbox is blocked when allowUnsandboxedCommands is set to false. Built-in file tools such as Read, Edit, Write, WebFetch and WebSearch do not pass through this path, so confirm their rules separately.

How a Bash command request moves through permission checks and the sandbox.

Evidence a security reviewer should request

This table lists the evidence to request for Claude Code permissions and sandboxing, what each item shows, and where the setting or behavior is documented. Use it to turn the sandbox and permission claims into artifacts you can inspect on managed machines. The main takeaway is that a stated policy only counts once the managed settings file, rule lists and installed version are shown together.

ControlEvidence to requestWhere it comes from
Mandatory sandboxManaged settings file showing failIfUnavailable set to true and allowUnsandboxedCommands set to false, with the file location on each device classSandboxing docs for the managed settings keys; confirm the deployment path with your MDM or endpoint tooling
Permission mode policyWritten mode standard (auto or Manual), evidence that auto mode is turned off where required, and a sample session showing the active modeSecurity page for auto mode and Manual mode behavior; confirm the organization-level switch in your admin console
Network egress allowlistExported allowedDomains list with an owner and review date, plus proxy logs showing blocked hostnamesSandboxing docs for the local proxy and the empty default allowedDomains list
Filesystem read restrictionsExported denyRead list covering credential paths such as ~/.ssh and ~/.aws/credentials, and a test showing a sandboxed read is refusedSandboxing docs stating that reads are open by default unless denyRead rules are set
Version inventoryPer-device report of installed Claude Code versions, install method (npm or native installer), and auto-update status, compared against fixed versions in each advisoryGitHub security advisories for anthropics/claude-code; the npm package and native installer distribution
Uncovered tool testingTest results for Read, Edit, Write, WebFetch, WebSearch, hooks, local MCP servers and apiKeyHelper showing which permission rules and access limits applySandboxing docs listing the tools and hooks the sandbox does not cover; your own test plan
Native Windows handlingInventory showing whether any native Windows hosts run Claude Code, plus the compensating control for commands that run unsandboxed thereSandboxing docs stating native Windows runs commands unsandboxed
Vendor security postureAnthropic's SOC 2 Type 2 report and ISO 27001 certificate, and the HackerOne and advisory disclosure recordSecurity page and the Anthropic Trust Center; advisories list on GitHub

What the sandbox means for audit scope and incident response

Treat the sandbox and the permission rules as controls on the developer machine, and keep them out of the vendor's assurance scope when you plan audits. The SOC 2 Type 2 report and ISO 27001 certificate that Anthropic points to through its Trust Center describe Anthropic's own program, not the allowlists, denyRead entries or allowedDomains values set on your laptops. Before you rely on either artifact for this rollout, confirm with Anthropic exactly which systems and services the report covers, and confirm with your own assessor how your managed settings, endpoint management and local logs will be evidenced. Ask what sandbox or permission decisions are recorded centrally, what is only visible on the endpoint, and whether any of it can be exported to your SIEM.

Record the gaps before approval, not after an incident. Write down which tools run outside the sandbox in your configuration, including the built-in Read, Edit, Write, WebFetch and WebSearch tools, hooks, local MCP servers and apiKeyHelper, and name the owner and compensating control for each. Confirm whether Auto mode is on or off for each group, because that choice changes which actions a classifier reviews at all. When the sandbox fails closed or a developer falls back to an unsandboxed command, ask Anthropic and your endpoint tooling what event is written and how long it is retained. Your incident response runbook should name who can pull those records from a developer machine, and it should state that the workstation itself may be the only place some evidence exists.

Questions buyers ask about Claude Code permissions and sandboxing

Is the Claude Code Bash sandbox turned on by default?

No. The Bash sandbox is off by default, so a developer who installs Claude Code gets no OS-level isolation for shell commands until someone enables it. The sandbox uses Seatbelt on macOS and bubblewrap on Linux and WSL2, and it is built on the open source @anthropic-ai/sandbox-runtime package. Native Windows runs commands unsandboxed, so a Windows fleet needs a separate decision about what is acceptable. Before approving the tool, confirm which operating systems in your fleet can run the sandbox and how you will verify that it is enabled on each machine. The sandboxing documentation lists the settings involved.

Can administrators force the Claude Code sandbox to stay on?

Yes. Admins can make the sandbox mandatory through managed settings. Setting failIfUnavailable makes Claude Code exit instead of running commands unsandboxed when the sandbox cannot start. Setting allowUnsandboxedCommands to false disables the dangerouslyDisableSandbox retry, which otherwise lets a command run outside the sandbox. Together these two keys close the main escape routes at the Bash layer. Managed settings must reach each endpoint through your device management or a managed-settings file, so confirm with Anthropic which delivery methods your plan supports and test the enforced configuration on every OS in your fleet before relying on it.

Does the sandbox stop Claude Code from reading my SSH and AWS credentials?

Not by default. Sandboxed commands can write only to the working directory, a per-user temp directory and any added directories, but by default they can read most of the machine, including ~/.ssh and ~/.aws/credentials. To block those reads, you must add denyRead rules in settings. Write the rules for every credential location your developers use, including cloud CLI configuration, package registry tokens and browser profiles, then test them on a sample machine. Note that these rules govern Bash commands only, so the built-in Read tool needs its own permission rules.

How much does it cost to set up the sandbox and who does the work?

The sandbox itself has no separate fee in the researched material, but the subscription or API billing you choose determines what you pay for Claude Code. Confirm plan availability and billing with Anthropic before budgeting. Effort depends on fleet size, the mix of macOS, Linux, WSL2 and native Windows machines, how many managed settings channels you use, and how many read paths and network domains your teams need. Your internal security and endpoint teams own the policy and rollout. A fixed-scope engagement from DeployOpen can cover the configuration design, testing across your OS mix and documented evidence, with a quote following the written scope.

Can developers turn on the sandbox themselves?

Yes on a single laptop, but a fleet needs central enforcement. A developer can enable the sandbox in their own settings and add deny rules for their own credential paths. That works for one machine that one person controls. Across hundreds of endpoints, individual settings drift, developers can change them, and a local override can weaken a control. Use managed settings with failIfUnavailable and allowUnsandboxedCommands set to false so the policy is not left to individual choice. Check the security documentation for how permission modes and managed settings interact before finalizing the design.

Does the sandbox protect against prompt injection?

No, not in full. The sandbox limits what Bash commands can write, read and reach over the network, which reduces the damage a manipulated command can do. It does not cover the built-in Read, Edit, Write, WebFetch and WebSearch tools, hooks, local MCP servers or apiKeyHelper, which follow permission rules or run with full access. A malicious instruction that reaches one of those paths is not contained by the sandbox. Treat prompt injection as a separate risk, combine the sandbox with tight allow and deny rules and review MCP servers and hooks as trusted code. Confirm with Anthropic what it says remains the customer's responsibility.

How DeployOpen tests and governs Claude Code permissions

DeployOpen works on Claude Code permissions, allowlists and sandboxing as a fixed-scope engagement inside your own environment. The work starts with a written definition of what the agent may run, read and change on developer machines, then tests whether those settings hold under real prompts and attempted bypasses.

How we scope

  • Written scope lists the Claude Code plan, operating systems and developer machine types in use
  • Scope maps which commands, files and hosts developers need, and which must stay blocked
  • Scope names the managed settings channel and the owners who approve permission changes

How we build

  • Permission modes, allow and deny rules are configured and reviewed against the written policy
  • Bash sandbox filesystem and network settings are set, including denyRead paths for credential directories
  • Mandatory sandbox settings are tested on macOS, Linux and WSL2 machines, plus native Windows exclusions

How we hand over

  • Deliverables include the configuration, a test record and a list of areas the sandbox does not cover
  • Documentation explains which tools follow permission rules only, such as hooks and local MCP servers
  • Handover includes a checklist for admins to confirm sandbox enforcement and version updates on managed machines

How we support

  • Ongoing support and continuous testing are available as a retainer after the initial handover
  • Retainers can cover re-testing when Claude Code releases change permission or sandbox behavior
  • Your security team keeps approval of the final policy, and DeployOpen does not issue audit reports or attestations

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.