Bible Network Crypto DeFi Onchain RWA AI Agent Stablecoin Chain SAFU CryptoTax DeFAI AGI Claude Me Claude Skill Claude Design Claude Cowork
Independent Media
Not affiliated with any project
Learn Claude Skills. Do Everything Better.
claudeskill-me.com
LATEST
Watching Claude Code Compaction and Hooks Through OpenTelemetry: Reading the compaction, hook_execution_complete and precompute_reuse Fields  ·  Blind Spots in Bash Permission Rules: deny Misses /bin/rm, bash -c and git -C, and devbox run * Lets Any Inner Command Through  ·  CLAUDE.md Too Long? Use .claude/rules/ and paths So Rules Load Only When Claude Touches Matching Files  ·  Chromium Says No usable sandbox! Inside Claude Code's Sandbox: What --no-sandbox, excludedCommands and allowNestedUserNamespaces Each Give Up  ·  Claude Code v2.1.309 Fixes a Batch of Sandbox and Permission Gaps: Startup Files Outside the Sandbox, denyWrite Through Symlinks and More  ·  The auto mode $defaults Trap: Leave One String Out of autoMode.soft_deny and the Built-In Force-Push Rules Disappear
advanced

Chromium Says No usable sandbox! Inside Claude Code's Sandbox: What --no-sandbox, excludedCommands and allowNestedUserNamespaces Each Give Up

30-Second Version · For the impatient
None of the three fixes for Chromium in the sandbox is free; they differ only in whether you give up the browser's isolation, one command's limits, or a sandbox boundary.

Full Explanation +
01 · Why did this happen?

Which of the three is safest?

The docs do not rank them. By what each gives up, the narrowest is --no-Sandbox (only the browser's own isolation) and the widest is allowNestedUserNamespaces (the docs use a warning box and say code can end up running outside the sandbox). That ranking is my judgment.

02 · What is the mechanism?

I added playwright to excludedCommands and it has no effect. Why?

Most likely the pattern. The docs say it must end with *, every command in the call must match, and matching is on the call text, so a playwright run inside npm test does not count. Match the command Claude actually runs.

03 · How does it affect me?

Can I put it in the project settings.json for the whole team?

Not allowNestedUserNamespaces: the docs say to use user settings and that a repository cannot turn it on. For excludedCommands, entries in project files are ignored while the Sandbox is admin-required.

04 · What should I do?

I'm not an engineer. Why does this matter to me?

If someone switches one of these on just to get tests running, that opens a hole in your security. Knowing the three options and their costs lets you ask the right question in review.

Full Content +

Running Chromium, Playwright or rootless Podman inside Claude Code's Sandbox on Linux or WSL2 often ends in No usable sandbox!. The official sandbox page gives three ways out, and each gives up something different. This article puts them side by side. The facts come from the official sandbox page and changelog; I did not test the three approaches on my own machine, so the trade-offs are the docs' statements plus my own tidying.

The problem

The docs say that on Linux and WSL2 commands in the sandbox cannot create user namespaces by default, so tools that rely on them fail. Listed symptoms: Chromium exits with No usable sandbox!; unshare -U true prints Operation not permitted; rootless Podman prints cannot clone: Operation not permitted, or stops earlier with read-only file system on one of its own folders.

Option 1: start the browser with --no-sandbox

For Chromium or Electron, pass --no-sandbox. Claude Code's sandbox stays as it is; the cost is that the browser runs web content without its own sandbox. If the tests only open local pages you control, that cost is small; if they open external URLs, the risk sits at the browser layer. That is my judgment; the docs only say it gives up the browser's own isolation.

Option 2: excludedCommands, taking the whole command out of the sandbox

Put a command pattern in sandbox.excludedCommands and matching commands run outside the sandbox with your full access:

{
  "sandbox": {
    "enabled": true,
    "excludedCommands": ["npx playwright test *"]
  }
}

The docs list several rules that catch people:

  • End the pattern with *; a pattern with no wildcard is an exact match, so docker matches only docker with no arguments.
  • Every command in the call must match: npm ci && docker compose build stays sandboxed unless another entry covers npm ci.
  • Matching is on the text of the call: a script or make target that calls a tool internally does not match, and neither does /usr/local/bin/docker. For a browser, match the test command, not the browser.
  • A redirect to a file, a cd or $(...) keeps the whole call sandboxed.

The docs add a warning: Claude can edit a script in your working directory before running it, and an excluded command has your full access, so excluding a command that runs a script also lets that script's contents out of the sandbox. Excluded commands still go through the normal permission flow; in auto mode the classifier reviews them; in bypassPermissions mode they run without a prompt unless an ask rule matches.

Option 3: allowNestedUserNamespaces

Added in v2.1.305:

{
  "sandbox": {
    "allowNestedUserNamespaces": true
  }
}

The docs say to set it in ~/.claude/settings.json, not the project's .claude/settings.json, and that a repository cannot turn it on. The benefit is that Chromium or Electron keeps its own sandbox and nested bubblewrap or unshare can run. The cost is stated in a warning box: you turn off a security boundary, code from a sandboxed command can end up running outside the sandbox, you should not rely on any sandbox restriction, including protected paths and credentials.files, to stop a malicious command, and in auto-allow mode that command can run without a prompt. The page also says a command beginning with unshare stays sandboxed whatever excludedCommands says, and that this setting alone is not enough for rootless Podman or Buildah, which the sandbox stops in other ways too.

How to choose

  • Only Chromium or Electron tests, on content you own: start with option 1, the smallest scope.
  • Podman, Buildah, or scripts that run a browser: the docs point to excludedCommands and expect you to accept that those commands have full access.
  • You want the browser's own sandbox kept, or need nested bubblewrap: option 3, with the warning above accepted, and the docs suggest checking with your security team first if you have one.
  • If the session sets CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1: the docs say every command then runs sandboxed and none of these settings have an effect; use --no-sandbox for Chromium or Electron and run other tools yourself outside Claude Code.

The ordering (smallest scope first, then exclusion, namespaces last) is my recommendation based on how the docs describe each option, not on a comparison test I ran.

Sources: Configure the sandboxed Bash tool - Claude Code Docs, Claude Code changelog - Claude Code Docs
Diagram
沙盒內 Chromium/Podman 失敗的三種解法與各自代價No usable sandbox! 的三條出路:--no-sandbox 放棄瀏覽器隔離、excludedCommands 放棄單條命令的全部限制、allowNestedUserNamespaces 放棄沙盒一道邊界Chromium or rootless Podman fails in the Linux sandbox: three ways outNo usable sandbox! / cannot cloneuser namespaces are blocked by defaultOption 1--no-sandboxClaude Code sandbox stays onGives up: browser's own isolationNarrowestOption 2excludedCommandsMatching command runs outsideGives up: all limits, full accessPodman, BuildahOption 3allowNestedUserNamespacesBrowser keeps its own sandboxGives up: a sandbox boundaryWidest riskSet option 3 in ~/.claude/settings.json (needs v2.1.305+), a repository cannot turn it onCommands starting with unshare stay sandboxed whatever excludedCommands saysWith CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1 every command is sandboxed and none of these applyClaude Skill Me · claudeskill-me.com
Feel free to share. Please credit the source.
Ask a Question
Please enter at least 10 characters
Related Terms
Related Articles
Blind Spots in Bash Permission Rules: deny Misses /bin/rm, bash -c and git -C, and devbox run * Lets Any Inner Command Through
practice · Oct 23
The auto mode $defaults Trap: Leave One String Out of autoMode.soft_deny and the Built-In Force-Push Rules Disappear
practice · Oct 23
Watching Claude Code Compaction and Hooks Through OpenTelemetry: Reading the compaction, hook_execution_complete and precompute_reuse Fields
advanced · Oct 23
Fork Subagents Inherit the Whole Conversation Instead of Starting Blank — and Since v2.1.302 They Are On by Default in VS Code, Desktop and Headless Runs
advanced · Oct 19
Related News
More Related Topics