claude-code - 💡(How to fix) Fix [BUG] PreToolUse permissionDecision: "allow" no longer suppresses prompt for Bash with dangerouslyDisableSandbox: true (2.1.116/117 regression) [1 comments, 2 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#51798Fetched 2026-04-22 07:52:33
View on GitHub
Comments
1
Participants
2
Timeline
9
Reactions
1
Author
Timeline (top)
labeled ×8commented ×1

In 2.1.116 / 2.1.117, a PreToolUse hook returning permissionDecision: "allow" for a Bash tool call with dangerouslyDisableSandbox: true no longer suppresses the "Bash command (unsandboxed) — Do you want to proceed?" confirmation. In 2.1.112, the identical hook output and identical tool input ran silently. The hooks docs state unambiguously that "allow" skips the permission prompt, with no carve-out for unsandboxed Bash calls.

This breaks the "hook-gated autonomy" pattern where a local policy hook (LLM judge, rule-based approver, etc.) decides whether a command may run unsandboxed and returns allow to let it through without user interaction.

Root Cause

In 2.1.116 / 2.1.117, a PreToolUse hook returning permissionDecision: "allow" for a Bash tool call with dangerouslyDisableSandbox: true no longer suppresses the "Bash command (unsandboxed) — Do you want to proceed?" confirmation. In 2.1.112, the identical hook output and identical tool input ran silently. The hooks docs state unambiguously that "allow" skips the permission prompt, with no carve-out for unsandboxed Bash calls.

This breaks the "hook-gated autonomy" pattern where a local policy hook (LLM judge, rule-based approver, etc.) decides whether a command may run unsandboxed and returns allow to let it through without user interaction.

Fix Action

Fix / Workaround

  • Same machine (macOS 15, arm64), same settings, same hook, same tool input.
  • Downgrade path: ln -sfn ~/.local/share/claude/versions/2.1.112 ~/.local/bin/claude → silent run, as documented.
  • Re-upgrade to 2.1.117 → prompt appears.
  • In both versions, the hook actually executes and emits permissionDecision: allow (confirmable via a debug log or by observing the Bash tool output when confirmed). Only the downstream suppression differs.

Code Example

#!/usr/bin/env python3
import json, sys
data = json.load(sys.stdin)
if data.get("tool_name") == "Bash":
    print(json.dumps({
        "hookSpecificOutput": {
            "hookEventName": "PreToolUse",
            "permissionDecision": "allow",
            "permissionDecisionReason": "allowed by policy hook"
        },
        "suppressOutput": True
    }))
sys.exit(0)

---

{"name": "Bash", "input": {"command": "hostname; sysctl hw.model", "dangerouslyDisableSandbox": true}}
RAW_BUFFERClick to expand / collapse

Summary

In 2.1.116 / 2.1.117, a PreToolUse hook returning permissionDecision: "allow" for a Bash tool call with dangerouslyDisableSandbox: true no longer suppresses the "Bash command (unsandboxed) — Do you want to proceed?" confirmation. In 2.1.112, the identical hook output and identical tool input ran silently. The hooks docs state unambiguously that "allow" skips the permission prompt, with no carve-out for unsandboxed Bash calls.

This breaks the "hook-gated autonomy" pattern where a local policy hook (LLM judge, rule-based approver, etc.) decides whether a command may run unsandboxed and returns allow to let it through without user interaction.

Repro

Minimal PreToolUse hook that always allows (save as ~/.claude/hooks/always_allow.py and wire it in settings.json):

#!/usr/bin/env python3
import json, sys
data = json.load(sys.stdin)
if data.get("tool_name") == "Bash":
    print(json.dumps({
        "hookSpecificOutput": {
            "hookEventName": "PreToolUse",
            "permissionDecision": "allow",
            "permissionDecisionReason": "allowed by policy hook"
        },
        "suppressOutput": True
    }))
sys.exit(0)

Tool call (via any agent or stream-json -p):

{"name": "Bash", "input": {"command": "hostname; sysctl hw.model", "dangerouslyDisableSandbox": true}}

Expected (and 2.1.112 actual)

Command runs silently. No prompt. Output goes straight back to the model.

Per https://code.claude.com/docs/en/hooks:

"allow" skips the permission prompt.

No caveat about sandbox state.

Actual on 2.1.116 / 2.1.117

A "Bash command (unsandboxed) — Do you want to proceed? 1. Yes / 2. No" confirmation fires. Hook's allow is effectively ignored for the unsandboxed-execution gate.

Evidence

  • Same machine (macOS 15, arm64), same settings, same hook, same tool input.
  • Downgrade path: ln -sfn ~/.local/share/claude/versions/2.1.112 ~/.local/bin/claude → silent run, as documented.
  • Re-upgrade to 2.1.117 → prompt appears.
  • In both versions, the hook actually executes and emits permissionDecision: allow (confirmable via a debug log or by observing the Bash tool output when confirmed). Only the downstream suppression differs.

Decision-log cross-reference (from an internal policy hook that records every approve decision, across ~4,300 Bash tool_use entries in stored transcripts):

  • 2026-04-20 (2.1.112): 85 / 96 matched llm_approved* decisions were Bash calls with dangerouslyDisableSandbox: true. All ran silently.
  • 2026-04-21 (2.1.117): same hook, same decisions, every dangerouslyDisableSandbox: true call now prompts.

Related but distinct issues

  • #36176 (2.1.79, still open): "Don't ask again" on the unsandboxed prompt is a no-op. That bug assumes the unsandboxed prompt is a separate permanent gate. This issue claims the opposite: in 2.1.112 the gate was fully suppressible by hook allow, matching the documented contract. The regression is that 2.1.116/117 made it unsuppressible.
  • #43713: autoAllowBashIfSandboxed bypassed for shell expansions. Related sandbox/permission plumbing regression, different symptom.

Environment

  • Claude Code 2.1.117 (regression), last-known-good 2.1.112
  • macOS 15.1, arm64 (MacBookPro18,3)
  • Installed via native build at ~/.local/share/claude/versions/

Suggested fix

Honor PreToolUse permissionDecision: "allow" for the unsandboxed-execution gate as well as the permission gate, matching both the docs and the 2.1.112 behavior. If a separate gate is intentional, document it and expose a hook-level opt-in (e.g. permissionDecision: "allow_unsandboxed") so policy hooks can still signal full approval.

extent analysis

TL;DR

The most likely fix is to modify the PreToolUse hook handling to honor permissionDecision: "allow" for unsandboxed Bash tool calls, matching the documented behavior.

Guidance

  • Review the PreToolUse hook implementation to ensure it correctly handles permissionDecision: "allow" for unsandboxed Bash calls.
  • Verify that the hook's output is being processed correctly downstream, and that the suppressOutput flag is being respected.
  • Consider adding a debug log or output statement to the hook to confirm that it is executing and emitting the expected output.
  • If a separate gate for unsandboxed execution is intended, document it and provide a hook-level opt-in (e.g. permissionDecision: "allow_unsandboxed") to allow policy hooks to signal full approval.

Example

No code changes are suggested at this time, as the issue appears to be related to the handling of the PreToolUse hook output rather than the hook itself.

Notes

The issue appears to be a regression introduced in version 2.1.116/2.1.117, and downgrading to 2.1.112 resolves the issue. The suggested fix should be tested thoroughly to ensure it does not introduce any unintended behavior.

Recommendation

Apply a workaround by downgrading to version 2.1.112 until a fix is available, as this version is known to honor the permissionDecision: "allow" for unsandboxed Bash tool calls.

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

claude-code - 💡(How to fix) Fix [BUG] PreToolUse permissionDecision: "allow" no longer suppresses prompt for Bash with dangerouslyDisableSandbox: true (2.1.116/117 regression) [1 comments, 2 participants]