[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.
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗