Skip to content

fix(examples/settings): make bash-sandbox example fail closed when sandbox unavailable - #81421

Open
mholovetskyi wants to merge 1 commit into
anthropics:mainfrom
mholovetskyi:fix/sandbox-example-fail-closed
Open

fix(examples/settings): make bash-sandbox example fail closed when sandbox unavailable#81421
mholovetskyi wants to merge 1 commit into
anthropics:mainfrom
mholovetskyi:fix/sandbox-example-fail-closed

Conversation

@mholovetskyi

Copy link
Copy Markdown

Problem

examples/settings/settings-bash-sandbox.json is documented in the README table as "Bash tool must run inside of sandbox", but the config omits failIfUnavailable. Per the sandboxing docs, when the sandbox cannot initialize, Claude Code shows a warning and runs commands without sandboxing — and the sandbox does not run on native Windows at all, nor on Linux hosts missing bubblewrap.

So as written, the enforcement example silently fails open exactly where enforcement matters most: an organization deploying this file as managed policy across a mixed fleet gets unsandboxed Bash on every Windows machine, with no policy violation surfaced.

Fix

  • Add "failIfUnavailable": true to the sandbox block. This matches the managed-enforcement snippet recommended in the sandboxing docs (enabled + failIfUnavailable + allowUnsandboxedCommands: false).
  • Add a Tips bullet to examples/settings/README.md documenting the macOS/Linux/WSL2 platform constraint and the fail-open default, so admins merging these snippets understand the behavior.

Notes

  • These examples carry the README's community-maintained banner; this change only strengthens the guarantee the table already claims for this file.
  • JSON validated after the edit.
  • Searched open PRs for failIfUnavailable and for changes to this example before filing — found none.

🤖 Generated with Claude Code

…ndbox unavailable

The settings-bash-sandbox.json example is documented as 'Bash tool must
run inside of sandbox', but without failIfUnavailable Claude Code falls
back to running commands unsandboxed (with a warning) whenever the
sandbox cannot initialize - including on all native Windows hosts and
Linux hosts without bubblewrap. Add failIfUnavailable: true to match the
managed-enforcement configuration recommended in the sandboxing docs,
and document the platform constraint in the README.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant