[BUG] Bash(foo *) wildcard does not match bare command with no arguments, contrary to docs
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
The docs at https://code.claude.com/docs/en/permissions#wildcard-patterns state that Bash(ls ) with a space before "enforces a word boundary, requiring the prefix to be followed by a space or end-of-string." This implies Bash(git stash *) should match both git stash list (space) and bare git stash
(end-of-string). In practice, it does not match the bare command — the user is prompted for permission.
The deprecated : syntax (Bash(git stash:)) does correctly match both cases.
What Should Happen?
Bash(foo *) should match foo (bare, no arguments) in addition to foo <args>, as documented.
Error Messages/Logs
Steps to Reproduce
- Add "Bash(git stash *)" to .claude/settings.json allow list (no bare "Bash(git stash)" entry)
- Start a Claude Code session
- Have Claude run git stash (bare, no arguments)
- Observe: user is prompted for permission (should be auto-allowed)
- Now replace with "Bash(git stash:*)" (deprecated colon syntax)
- Repeat step 3
- Observe: command runs without prompting (correct behavior)
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.44
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
The workaround is to use the deprecated : syntax, which handles both cases. Alternatively, users can double every entry with both Bash(foo ) and Bash(foo), but this is verbose. The docs should either be corrected to note that * requires at least one argument, or the behavior should be fixed to match the documented "end-of-string" semantics.
6 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
some of those issues overlap, but they aren't obviously describing quite the same behavior
I am here because I find the documentation on wildcard patterns completely wrong about this topic:
-- https://code.claude.com/docs/en/permissions#wildcard-patterns
The legacy syntax is what works - the new syntax with a space does not work. By the way this report is completely human generated an
I have this in allow:
But when I accept always allow, claude adds this rule:
After:
<img width="724" height="269" alt="Image" src="https://github.com/user-attachments/assets/eb2ede61-3b4d-45f3-afb2-35506b3e3419" />
The wildcard
Bash(foo *)not matching barefoo(no arguments) is a pattern-matching bug. A hook handles both cases:The hook extracts the base command name (
awk '{print $1}') and matches it.ls,ls -la,ls /path— all match the samelscase. No wildcard syntax issues, no argument-dependent matching problems.This was fixed in v2.1.72 — Bash permission patterns like
Bash(git stash *)now also match the bare command with no arguments, as documented. If you're still seeing this in the latest version, please comment with your version and repro and we'll reopen.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.