[BUG] Bash permission pattern breaks when command contains parentheses
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?
Any ( or ) character in a Bash command causes the permission allow-list matching to fail, even when the command should match a Bash(... **) pattern.
What Should Happen?
Parentheses in command strings should be treated as literal characters during permission matching. For example, with "Bash(cat **)" in the allow list, cat 'hello()' should be auto-allowed just like cat 'hello' is.
Error Messages/Logs
Steps to Reproduce
- Add "Bash(cat **)" to the permissions.allow list in .claude/settings.json:
{
"permissions": {
"allow": [
"Bash(cat **)"
]
}
}
- Test various commands:
| Command | Expected | Actual |
|------------------|--------------|--------------|
| cat 'hello' | Auto-allowed | Auto-allowed |
| cat 'bla () bla' | Auto-allowed | Auto-allowed |
| cat 'hello()' | Auto-allowed | Prompts |
| cat 'bla(x)' | Auto-allowed | Prompts |
| cat 'bla)' | Auto-allowed | Prompts |
| cat 'bla(' | Auto-allowed | Prompts |
| cat '(bla' | Auto-allowed | Prompts |
| cat ')bla' | Auto-allowed | Prompts |
| cat 'bla(bla' | Auto-allowed | Prompts |
| cat 'hello() ' | Auto-allowed | Auto-allowed |
- Any ( or ) in the command breaks matching — except when surrounded by spaces (e.g. bla () bla).
- Workaround: Append a trailing space to commands that contain parentheses:
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.72 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Xterm
Additional Information
_No response_
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗