claude-code - 💡(How to fix) Fix [BUG] `excludedCommands` entries with `:*` suffix silently disable the entire sandbox for all Bash calls [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#45113Fetched 2026-04-09 08:12:57
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×5

Error Message

  • (b) If the :* syntax is not supported in excludedCommands (only in Bash(...) permission patterns), reject malformed entries at load time with a clear error. Do not silently disable the sandbox.

Error Messages/Logs

Root Cause

  • #10524 — excludedCommands does exact match and requires :* to work with arguments. Currently open. The top-voted workaround there is what triggers this regression.
  • #12150 — excludedCommands leaks proxy env vars into child processes. Auto-closed for inactivity without a fix. Relevant because even a correctly-working excludedCommands still inherits proxy env vars, which breaks Deno-compiled CLIs that honor ALL_PROXY but cannot use SOCKS schemes via env vars.

Fix Action

Fix / Workaround

Adding an entry with a :* suffix to sandbox.excludedCommands — the community workaround widely celebrated in #10524 to fix the "exact match only" pattern problem — disables the entire sandbox for all subsequent Bash tool calls, not just the matched command.

State B — edit to "linear:*" (the community workaround)

  • #10524 — excludedCommands does exact match and requires :* to work with arguments. Currently open. The top-voted workaround there is what triggers this regression.
  • #12150 — excludedCommands leaks proxy env vars into child processes. Auto-closed for inactivity without a fix. Relevant because even a correctly-working excludedCommands still inherits proxy env vars, which breaks Deno-compiled CLIs that honor ALL_PROXY but cannot use SOCKS schemes via env vars.

Code Example

"sandbox": {
  "enabled": true,
  "autoAllowBashIfSandboxed": true,
  "excludedCommands": ["linear"]
}

---

$ env | grep -i proxy | head -3
HTTP_PROXY=http://localhost:63682
HTTPS_PROXY=http://localhost:63682
ALL_PROXY=socks5h://localhost:63683

$ touch /Users/vit/Documents/works/SomePathNotInAllowlist/sandbox-test
touch: /Users/vit/Documents/works/SomePathNotInAllowlist/sandbox-test: Operation not permitted

---

$ env | grep -i proxy | head -3
(empty — all proxy env vars gone)

$ touch /Users/vit/Documents/works/SomePathNotInAllowlist/sandbox-test
(succeeds)

$ ls /Users/vit/Documents/works/SomePathNotInAllowlist/sandbox-test
-rw-r--r--  1 user  staff  0 Apr  8 11:12 sandbox-test

---

$ env | grep -i proxy | head -3
HTTP_PROXY=http://localhost:63682
HTTPS_PROXY=http://localhost:63682
ALL_PROXY=socks5h://localhost:63683

$ touch /Users/vit/Documents/works/SomePathNotInAllowlist/sandbox-test
touch: /Users/vit/Documents/works/SomePathNotInAllowlist/sandbox-test: Operation not permitted
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Adding an entry with a :* suffix to sandbox.excludedCommands — the community workaround widely celebrated in #10524 to fix the "exact match only" pattern problem — disables the entire sandbox for all subsequent Bash tool calls, not just the matched command.

This is a silent security regression. /sandbox still reports the sandbox as enabled, proxy env vars disappear from Bash calls, and writes to non-allowlisted paths succeed. Users following the top-voted comment in #10524 ("uv:*", 29 👍, 8 hooray, 11 heart) believe their sandbox is active while it is in fact entirely off.

Reproduction

Starting ~/.claude/settings.json:

"sandbox": {
  "enabled": true,
  "autoAllowBashIfSandboxed": true,
  "excludedCommands": ["linear"]
}

State A — "linear" (no :*), baseline

Run Bash tool calls:

$ env | grep -i proxy | head -3
HTTP_PROXY=http://localhost:63682
HTTPS_PROXY=http://localhost:63682
ALL_PROXY=socks5h://localhost:63683

$ touch /Users/vit/Documents/works/SomePathNotInAllowlist/sandbox-test
touch: /Users/vit/Documents/works/SomePathNotInAllowlist/sandbox-test: Operation not permitted

Sandbox is active: proxy env vars injected, write to a non-allowlisted path is blocked.

State B — edit to "linear:*" (the community workaround)

Change the entry from "linear" to "linear:*". No other edits. Run Bash calls again:

$ env | grep -i proxy | head -3
(empty — all proxy env vars gone)

$ touch /Users/vit/Documents/works/SomePathNotInAllowlist/sandbox-test
(succeeds)

$ ls /Users/vit/Documents/works/SomePathNotInAllowlist/sandbox-test
-rw-r--r--  1 user  staff  0 Apr  8 11:12 sandbox-test

Sandbox is effectively off. Critically, the env command does not match the linear:* pattern at all, yet it runs in an unsandboxed shell. Every subsequent Bash call is unsandboxed.

State C — revert to "linear"

Change back to the original. Next Bash call:

$ env | grep -i proxy | head -3
HTTP_PROXY=http://localhost:63682
HTTPS_PROXY=http://localhost:63682
ALL_PROXY=socks5h://localhost:63683

$ touch /Users/vit/Documents/works/SomePathNotInAllowlist/sandbox-test
touch: /Users/vit/Documents/works/SomePathNotInAllowlist/sandbox-test: Operation not permitted

Sandbox is restored. The behavior is deterministic and fully reversible. Reproduced under both "auto" and "standard" sandbox modes (/sandbox toggling between the two).

What Should Happen?

One of:

  • (a) Parse "linear:*" correctly so it matches only linear <anything> and does not affect other commands. The sandbox should remain active for all non-matching calls.
  • (b) If the :* syntax is not supported in excludedCommands (only in Bash(...) permission patterns), reject malformed entries at load time with a clear error. Do not silently disable the sandbox.

Either way, /sandbox should not report the sandbox as enabled when it is, in effect, entirely off.

Related issues

  • #10524 — excludedCommands does exact match and requires :* to work with arguments. Currently open. The top-voted workaround there is what triggers this regression.
  • #12150 — excludedCommands leaks proxy env vars into child processes. Auto-closed for inactivity without a fix. Relevant because even a correctly-working excludedCommands still inherits proxy env vars, which breaks Deno-compiled CLIs that honor ALL_PROXY but cannot use SOCKS schemes via env vars.

Error Messages/Logs

No errors. The sandbox silently deactivates. /sandbox continues to report "Sandbox enabled" during the regression, which is the most concerning aspect — there is no user-facing indication that anything is wrong.

Steps to Reproduce

  1. In ~/.claude/settings.json, set sandbox.enabled: true and add an excludedCommands entry without :*, e.g. "linear".
  2. Start a Claude Code session. Run a Bash tool call with env | grep -i proxy and touch on a path outside the allowlist. Verify sandbox is active.
  3. Edit the entry to "linear:*" (the top-voted community workaround from #10524). Save.
  4. Run another Bash tool call with the same commands.
  5. Observe that proxy env vars are empty and the touch succeeds. The sandbox is effectively off for all Bash calls, not only ones matching linear:*.
  6. Revert to "linear". Sandbox returns to active state on next call.

Claude Model

Opus (custom / 1M context)

Is this a regression?

I don't know — this requires the :* community workaround, which gained traction in #10524 comments through Nov 2025. Users may have been unknowingly running without a sandbox for months.

Last Working Version

No response

Claude Code Version

2.1.96 (Claude Code)

Platform

Anthropic API

Operating System

macOS 26.1 (arm64)

Terminal/Shell

zsh 5.9

Additional Information

The original scenario that led me to the :* workaround was a deno compile CLI (@schpet/linear-cli) failing in the sandbox because Deno's fetch honors ALL_PROXY=socks5h://... but cannot use SOCKS schemes via env vars (denoland/deno discussion#17606), while Go-based tools like gh silently worked because Go's net/http ignores ALL_PROXY. Either fixing this :* regression or scrubbing proxy env vars when spawning excluded commands would resolve both problems. The latter (proxy env scrubbing) is already requested in #12150.

I've worked around the original CLI problem with a local wrapper script, but the sandbox disable regression is independent of that scenario and would affect any user who followed the #10524 workaround.

extent analysis

TL;DR

The sandbox is silently disabled when using the :* suffix in excludedCommands, allowing unauthorized access, and a fix is needed to either correctly parse the :* syntax or reject malformed entries.

Guidance

  • Verify that the issue is reproducible by following the steps outlined in the reproduction section, specifically testing with and without the :* suffix in excludedCommands.
  • Consider reverting to the original excludedCommands entry without the :* suffix to restore sandbox functionality until a proper fix is available.
  • Review related issues, such as #10524 and #12150, to understand the context and potential workarounds for the underlying problems.
  • Test the behavior with different sandbox modes (e.g., "auto" and "standard") to ensure the issue is not mode-specific.

Example

No code snippet is provided as the issue is related to configuration and not code.

Notes

The provided information suggests that this is a regression, but the exact version where the regression occurred is unknown. The issue seems to be related to the :* syntax in excludedCommands and its interaction with the sandbox functionality.

Recommendation

Apply a workaround by avoiding the use of the :* suffix in excludedCommands until a proper fix is available, as this suffix silently disables the sandbox, posing a security risk.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING