Urgent.News

What's breaking now, across hundreds of outlets.

AI

Claude Code permissions and sandbox settings explained (2026)

Short answer : Claude Code has two separate controls. Permission rules (allow, ask, deny) and permission modes decide whether a tool call runs and whether you are asked first, and they apply to every tool: Read, Edit, Bash, WebFetch, MCP. The Bash sandbox is a boundary the operating system enforces (Seatbelt on macOS, bubblewrap on Linux and WSL2) around shell commands only. It is off by default.…

Claude Code offers two separate controls for permissions and sandbox settings: permission rules and permission modes. The permission rules consist of allow, ask, and deny settings that apply to all tool calls, including Read, Edit, Bash, WebFetch, and MCP tools. These rules are defined using patterns like Read(...), Edit(...), Bash(git push *), and WebFetch(domain:example.com) in a settings file.

The OS-level sandbox, such as Seatbelt on macOS, bubblewrap on Linux, and WSL2, enforces a boundary around shell commands when enabled. By default, it restricts commands to the working directory, a per-user temp directory, and specified directories, while allowing read access to most of the machine except for certain credential files.

The network traffic of the Bash sandbox goes through a local proxy with an initially empty allowed domains list.

Claude's file tools, MCP servers, and hooks run outside the sandbox. For total isolation, it is recommended to run the agent in a container, VM, or sandbox on another machine. The two layers of protection are permission rules (which tool calls run) and permission modes (whether a prompt is shown). The Bash sandbox restricts a running shell command's ability to read, write, and access resources, enforcing these restrictions at the OS kernel level.

Common mistakes include assuming the sandbox limits everything Claude reads, as a denyRead entry does not stop the Read tool, and allowedDomains does not limit WebFetch. To block secrets, both permission rules and sandbox settings should be configured accordingly.

Permission rules are configured using patterns in a settings file, following a deny-first, ask-second, and allow-last evaluation order. The UVM article highlights the importance of specifying paths correctly - absolute paths in Read and Edit rules, and relative paths for sandbox filesystem settings. Permission modes determine who approves a call, with Manual mode prompting for approval, auto mode using a classifier, dontAsk refusing unauthorized calls, plan mode gating commands, and bypassPermissions flag (dangerously-skip-permissions) to skip prompts altogether.

The sandbox can be enabled by setting /sandbox in a session, with options such as auto-allow or regular permissions, and turning on credentials protection. On Linux and WSL2, bubblewrap and socat need to be installed first. To verify the sandbox's functionality, a user can attempt to run touch ~/sandbox-probe, which should fail. When creating a user settings file that blocks SSH and AWS keys, strips a token, allows two registries, and prevents unsandboxed retries, the following JSON structure can be used:

```json

{

"sandbox": {

"enabled": true,

"allowUnsandboxedCommands": false,

"failIfUnavailable": true,

"network": {

"allowedDomains": ["github.com", "*.npmjs.org"]

},

"credentials": {

"files": [

{

"path": "~/.ssh",

"mode": "deny"

},

{

"path": "~/.aws/credentials",

"mode": "deny"

}

],

"envVars": [

{

"name": "GITHUB_TOKEN",

"mode": "deny"

}

]

}

}

}

```

It's important to note that Claude Code does not have a built-in credential deny list; only what you explicitly name will be protected. The unsandboxed retry feature can be disabled by setting allowUnsandboxedCommands to false, effectively removing it. Excluded commands run with full access, and Docker does not function inside the sandbox. Users should keep their patterns narrow and avoid broad write rules to $PATH directories or shell startup files.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

More from Dev.to on urgent.news

Get the news by email. Yesterday's most-covered stories, every morning.

See today's edition · More options

More in AI

If You're a Young Investor Looking to Invest in AI, Here Are 2 Stocks to Hold for the Next 5 Years

Rather than chasing the latest fashionable stock, consider established businesses with strong competitive advantages, loyal customers, and the financial resources to turn technological progress into…

  • Alphabet's Google Cloud revenue surged 103% in Q3
  • Amazon Web Services leads global AI infrastructure with 28% market share
  • Both companies offer AI growth potential with distinct business advantages

OpenAI’s annualized revenue reportedly hovers at $50B

Revenue was reportedly stagnant for the quarter, but the company also had a billing issue with its two new frontier models, it said, and ad revenue may be improving.

  • OpenAI's annualized revenue reportedly reached $50 billion by end of November
  • New model iterations launched on November 17 with billing glitch
  • Ad revenue increased to $3 billion annualized run rate by Cyber Monday

More from Saturday, 5 December 2026 →