Permission deny rules not enforced for Bash commands
Status Fixed / completed
Maintainer reply ✓ Yes — bcherny
Activity 5 comments · opened Feb 17, 2026 · closed Feb 18, 2026
💡 Likely answer: A maintainer (bcherny, collaborator)
responded on this thread — see the highlighted reply below.
Bug Description
Claude Code is not respecting the deny rules configured in .claude/settings.json for Bash commands.
Steps to Reproduce
- Configure
.claude/settings.jsonwith a deny rule for gcloud:
{
"permissions": {
"deny": [
"Bash(*gcloud*)"
]
}
}
- Ask Claude to run a gcloud command (e.g.,
run gcloud -horgcloud) - Claude executes the command despite it being in the deny list
Expected Behavior
Commands matching patterns in the deny list should be blocked and never execute.
Actual Behavior
Claude successfully executed gcloud -h and gcloud commands even though Bash(*gcloud*) is explicitly denied in settings.json. The deny rules simply don't deny anything.
Configuration
{
"defaultMode": "dontAsk",
"permissions": {
"allow": [...],
"deny": [
"Bash(*kubectl*)",
"Bash(*terraform*)",
"Bash(*aws*)",
"Bash(*gcloud*)",
"Bash(*sudo*)",
"Bash(*rm*)",
...
],
"ask": [...]
},
"sandbox": {
"enabled": false,
"autoAllowBashIfSandboxed": false,
"allowUnsandboxedCommands": false
},
"disableBypassPermissionsMode": "enforce"
}
Impact
This is a security issue as it allows bypassing user-configured safety restrictions for dangerous commands like kubectl, terraform, aws, gcloud, sudo, rm, etc.
Environment
- Claude Code version: [unknown from session]
- Platform: macOS (Darwin 25.1.0)
- Model: claude-sonnet-4-5-20250929
5 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
This is a bug in the settings.json -- you want
"disableBypassPermissionsMode": "disable". You should have gotten a warning about invalid settings.json on startup, did you not see it?Sorry that was actually set to "disable". Bug exists and deny rules are not enforced. Can you please reopen the issue?
I've had to write a Hook in order to actually enforce deny rules.
@bcherny Can you reopen this issue? It was closed prematurely.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.