Citation and evidence

Claude Code Permissions and Sandboxing

11 min full readUpdated 18 references

This article's verification

Report a problem with this article

More

Use this article

Raw MarkdownExplore connections

Improve this page

Suggest editRevision historyDiscussion

Browse categories

AI Code GenerationAnthropicDeveloper Tools

Cite this article

Claude Code permissions determine whether a tool may run, whether it requires approval, and whether the application blocks it. Sandboxing restricts the files and network destinations available to a running process. They are separate controls: approving a command does not isolate it, and an isolated command can still damage files or use services that its environment permits.[1][14]

Anthropic introduced its sandboxed Bash tool in October 2025 to reduce repeated approval prompts while limiting command access. The implementation uses operating-system controls rather than relying on the model to obey a written instruction.[10] This reference describes the documentation reviewed on September 27, 2026, alongside the official changelog through Claude Code 2.1.283. Older clients can differ, especially in their starting permission mode.[3][17]

Quick reference

TaskRelevant controlWhat to check
Inspect permission rules/permissionsThe rule and the settings source that supplied it.[2]
Inspect command isolation/sandboxThe mode, overrides, and resolved configuration.[6]
Start with manual reviewclaude --permission-mode defaultSaved allow rules can still approve matching actions.[3][8]
Explore before implementingclaude --permission-mode planPlan mode is an approval policy, not a separate machine.[3]
Use a temporary settings configuration--settings <file-or-json>It supplements existing settings rather than clearing them.[4][8]
Check the installed releaseclaude --versionCompare it with the documentation for the relevant setting.[8]
Check configuration problemsclaude doctor and /statusInvalid entries, missing dependencies, and the sources actually loaded.[4]

Expanded article table

For a broader command lookup, see Claude Code CLI Flags.

Permission modes

Configuration valuePrincipal behavior
defaultManual review, with exceptions for already permitted actions.
acceptEditsApproves in-scope file changes and supported filesystem commands automatically.
planSupports investigation and plan preparation; command approval depends on session configuration.
autoUses a classifier for actions that reach its review stage.
dontAskRejects calls that would require a prompt; already authorized actions can run.
bypassPermissionsRemoves most approval prompts, while specified blocking rules and exceptional checks remain.

Expanded article table

The modes are not equivalent security levels: dontAsk denies unapproved calls; bypass generally permits them.[3]

From 2.1.283, interactive terminal and VS Code sessions start in auto mode when available and not overridden. The value named default therefore does not necessarily describe a session's starting mode.[3][17]

Interactive terminal sessions with bypass available do not enforce Plan mode's usual edit restrictions. A planning prompt is therefore not a read-only boundary.[3]

Auto mode and sandbox auto-allow

Auto mode delegates approval decisions to a classifier. Anthropic's March 2026 engineering account describes a separate prompt-injection probe on tool outputs and a classifier that evaluates proposed actions against user intent. The classifier can miss harmful actions or reject legitimate ones; its published evaluation is not a guarantee for a particular repository or task.[11]

sandbox.autoAllowBashIfSandboxed approves sandboxed commands without the normal review flow. Turning it off preserves isolation. Content-specific ask rules still apply in auto-allow, but a blanket Bash ask rule is skipped.[5]

Writing and understanding permission rules

Rules use a tool name, optionally followed by a specifier. Put them under permissions.allow, permissions.ask, or permissions.deny. Evaluation is deny first, then ask, then allow. A narrower allow rule cannot override a matching broad deny.[2]

ExampleMeaning in the indicated list
Bash(git status) in allowApproves that command.
Bash(git push *) in askRequires confirmation for matching pushes.
Read(./.env) in denyDenies the matching file read.
Edit(./secrets/**) in denyDenies matching built-in file changes.
WebFetch(domain:example.com) in allowGrants matching web-fetch access.

Expanded article table

Rules do not recursively describe every action a program might perform. An allowed script can open files internally, and a command-name deny is not a general prohibition on the same effect through another program. For example, Anthropic documents that Bash(git push *) does not match git -C . push. Operating-system restrictions address a different problem from command-pattern matching.[14][18]

Instructions in CLAUDE.md guide the model but do not change these access checks. Hook-based decisions can add application-level enforcement; they are not operating-system isolation.[2][15]

What the sandbox contains

The integrated command sandbox covers Bash, PowerShell, and Monitor commands and their descendants. Built-in file tools, Model Context Protocol servers, and command hooks are outside that per-command boundary. Wrapping the whole Claude Code process in an appropriately configured runtime, container, or virtual machine covers a larger execution surface.[1]

Integrated platform support is documented as follows:[6]

PlatformIntegrated sandbox support
macOSUses Seatbelt.
LinuxUses bubblewrap, with socat for network relay.
WSL2Uses the Linux implementation and its dependencies.
Native WindowsNot supported by the integrated sandbox documentation reviewed for this article.

Expanded article table

The standalone @anthropic-ai/sandbox-runtime has Windows support, which does not establish support in Claude Code's integrated feature.[7]

The runtime enforces restrictions across the process tree. Its Linux implementation uses namespace isolation and host-side proxies; macOS uses Seatbelt profiles and a controlled proxy connection. Thus a program launched by an approved shell command remains subject to the process boundary.[7]

Files, credentials, and path syntax

Default writable locations include working, added, and per-user temporary directories. Reads can include credentials: enabling sandboxing does not automatically hide SSH keys or cloud credentials.[6]

The runtime uses separate read and write policies. Write grants identify writable areas, with write denials taking precedence. Read rules can deny a broad area and reopen a narrower one; more specific denies still protect files within a broader reopened region.[7]

Path syntax differs between configuration layers:

Intended locationRead/Edit permission patternSandbox filesystem path
Absolute /tmp/build//tmp/build/tmp/build
Home-directory path~/path~/path
Relative locationDepends on rule anchor and settings sourceDepends on settings source

Expanded article table

A single leading slash in Read/Edit rules is project-relative, unlike sandbox filesystem paths.[2][6]

sandbox.credentials can deny files and strip environment variables. Separately configured masking substitutes placeholders and injects real credentials at the proxy, subject to platform and TLS requirements. Neither is automatically enabled by sandboxing.[5]

Important settings and exceptions

The following settings control separate aspects of execution:[5]

SettingPurpose
sandbox.enabledEnables the integrated command sandbox.
sandbox.failIfUnavailableRefuses startup when required sandboxing cannot initialize.
sandbox.allowUnsandboxedCommandsControls the model-requested unsandboxed retry mechanism.
sandbox.excludedCommandsLists commands permitted to run outside the sandbox, subject to ordinary permissions.
sandbox.filesystem.disabledDisables filesystem isolation while retaining network isolation.
sandbox.network.strictAllowlistRejects unlisted hosts instead of allowing the normal approval path.

Expanded article table

Enabling sandboxing does not imply fail-closed startup. Blocking retries does not remove explicitly excluded commands.[6]

dangerouslyDisableSandbox requests an unsandboxed retry through ordinary permissions, potentially reviewed by a classifier rather than a human. Disabling retries does not contain the whole session.[6]

excludedCommands merges across loaded settings sources without a managed-only lock. Exclusions remain possible with retries disabled; inspect resolved settings rather than assuming absolute containment.[5]

The bypass flag

Claude --dangerously-skip-permissions selects bypassPermissions; it does not create an isolated environment. --allow-dangerously-skip-permissions makes the mode available without immediately selecting it. The similarly named dangerouslyDisableSandbox is a tool parameter, not the same control.[8]

Anthropic recommends an outer isolation boundary for unattended bypass use. That boundary must account for file tools, hooks, and MCP processes as well as shell commands.[1]

Settings scopes and precedence

SourceTypical purpose
~/.claude/settings.jsonPersonal settings across projects.
.claude/settings.jsonShared project settings.
.claude/settings.local.jsonPersonal settings for one project.
--settingsOverrides for one launch.
Managed settingsOrganization policy.

Expanded article table

The usual scalar precedence, highest first, is managed, command line, project-local, shared project, then user. Lists commonly merge instead of replacing one another, and some restrictive controls have special rules. An empty array is therefore not a reliable way to erase inherited permissions.[4]

Administrators can distribute managed settings through device policy, files, or supported server-managed mechanisms. /status identifies the source; claude doctor reports rejected entries. A policy on a developer's computer does not automatically reach a separately hosted cloud environment.[12]

Managed policy can disable bypass mode and limit permission rules to the managed tier with allowManagedPermissionRulesOnly. Such controls govern Claude Code's configuration. They do not remove a developer's independent operating-system access or prevent use of another program.[12]

Conservative configuration example

This illustrative launch requests manual review and fail-closed sandbox startup without editing settings files:[8][18]

claude --permission-mode default --settings '{"sandbox":{"enabled":true,"autoAllowBashIfSandboxed":false,"failIfUnavailable":true,"allowUnsandboxedCommands":false}}'

Existing allow rules, exclusions, filesystem grants, and managed policy remain relevant. Review /permissions, /sandbox, and /status. This is neither a credential-isolation profile nor an offline environment.[4]

Anthropic's secure-deployment guidance recommends narrowly scoped, preferably read-only mounts, controlled network endpoints, and proxy-held credentials. These controls must fit the workload.[14]

Security limits and operational review

A writable project remains writable inside a sandbox. In a development container, the bind-mounted workspace can reflect changes directly onto the host. Container isolation also does not protect secrets deliberately mounted into it or prevent their transmission over permitted connections. Anthropic recommends avoiding host credential mounts and using narrowly scoped or short-lived tokens.[13]

Network permission and content approval are different. A permitted service can accept a harmful request even when the connection itself is allowed. Hostname filtering does not, by itself, validate uploaded data, repository ownership, or the consequences of an API operation. Anthropic's deployment guidance discusses TLS-aware proxies and request validation for stronger controls.[14]

Prompt injection remains relevant because an agent reads material that can contain hostile instructions. The AgentDojo research benchmark evaluates agents acting on untrusted tool data and demonstrates failures in both task completion and attack resistance. It provides research context, not a certification of Claude Code or a measurement of the configuration above.[16]

Command hooks should be reviewed as executable code. A PreToolUse hook can reject an action even in bypass mode, while a broad PermissionRequest hook can approve more than intended. Hook commands themselves run with the user's permissions unless an outer boundary contains them. For event definitions and examples, see Claude Code Hooks.[15]

Anthropic's general security guidance recommends examining proposed commands and critical-file changes, treating external content cautiously, and using trusted MCP servers. Inclusion in the Anthropic connector directory is not proof that Anthropic has security-audited the server.[9]

Troubleshooting without silently widening access

ObservationCheck before changing policy
A setting appears ineffectiveConfirm its scope and loaded source; inspect validation errors.[4]
A command unexpectedly runs outside isolationCheck exclusions, retry approval, and sandbox startup failure behavior.[5]
A script cannot read an expected fileInspect both application permission rules and sandbox filesystem restrictions.[2][7]
A containerized task still affects local filesReview writable bind mounts and credentials available inside the container.[13]
Auto mode approves an action that seems out of scopeReview the actual task authorization and retained safeguards; classifier approval is fallible.[11]

Expanded article table

Version checks are part of security review. The 2.1.283 changelog, for example, records a fix for invalid nested managed sandbox values causing the sandbox block to be ignored. The documented corrected behavior retains the rest of the managed block and handles the invalid value restrictively. A current article cannot make an older installed client enforce a newer rule.[17]

References

  1. ^1 ^2 ^3Anthropic. Choose a sandbox environment. Claude Code documentation. Accessed September 27, 2026.
  2. ^1 ^2 ^3 ^4 ^5Anthropic. Configure permissions. Claude Code documentation. Accessed September 27, 2026.
  3. ^1 ^2 ^3 ^4 ^5 ^6Anthropic. Choose a permission mode. Claude Code documentation. Accessed September 27, 2026.
  4. ^1 ^2 ^3 ^4 ^5Anthropic. Settings files and precedence. Claude Code documentation. Accessed September 27, 2026.
  5. ^1 ^2 ^3 ^4 ^5Anthropic. All settings. Claude Code documentation, permission and sandbox entries. Accessed September 27, 2026.
  6. ^1 ^2 ^3 ^4 ^5 ^6Anthropic. Configure the sandboxed Bash tool. Claude Code documentation. Accessed September 27, 2026.
  7. ^1 ^2 ^3 ^4Anthropic. Sandbox Runtime. Official implementation repository and README. Accessed September 27, 2026.
  8. ^1 ^2 ^3 ^4 ^5Anthropic. CLI reference. Claude Code documentation. Accessed September 27, 2026.
  9. ^Anthropic. Security. Claude Code documentation. Accessed September 27, 2026.
  10. ^David Dworken and Oliver Weller-Davies. Beyond permission prompts: making Claude Code more secure and autonomous. Anthropic Engineering, October 20, 2025.
  11. ^1 ^2John Hughes. How we built Claude Code auto mode: a safer way to skip permissions. Anthropic Engineering, March 25, 2026.
  12. ^1 ^2Anthropic. Deploy managed settings. Claude Code documentation. Accessed September 27, 2026.
  13. ^1 ^2Anthropic. Development containers. Claude Code documentation. Accessed September 27, 2026.
  14. ^1 ^2 ^3 ^4Anthropic. Securely deploying AI agents. Claude Code and Agent SDK documentation. Accessed September 27, 2026.
  15. ^1 ^2Anthropic. Automate actions with hooks. Claude Code documentation. Accessed September 27, 2026.
  16. ^Edoardo Debenedetti et al. AgentDojo: A Dynamic Environment to Evaluate Prompt Injection Attacks and Defenses for LLM Agents. arXiv:2406.13352, 2024.
  17. ^1 ^2 ^3Anthropic. Claude Code changelog. Version 2.1.283 and preceding entries. Accessed September 27, 2026.
  18. ^1 ^2Anthropic. Example settings files. Claude Code documentation. Accessed September 27, 2026.

Improve this article

Add missing citations, update stale details, or suggest a clearer explanation. Every suggestion is reviewed for sourcing before it goes live.

v1 · 2,184 words · full history

Fact-checks are independent of edits: a reviewer re-verifies the article against its sources and stamps the date. How we verify

Research and drafting on this wiki are AI-assisted, under named human editorial standards. How AI is used here

Reviewer note: Independent AI-assisted editorial review checked the published text against cited primary documentation and research. Version-specific behavior and study limitations are stated in the article; this is not a guarantee of runtime behavior or factual infallibility.

Cite this page: AI Wiki. "Claude Code Permissions and Sandboxing." aiwiki.ai, updated 27 Sept 2026, fact-checked 27 Sept 2026. CC BY 4.0. https://aiwiki.ai/wiki/claude_code_permissions_and_sandboxing

Suggest edit