[BUG] Bash permission wildcard `*` rejects commands with quoted arguments
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 wildcard * in Bash permission patterns like Bash(MSBuild.exe *) does not match commands containing quoted arguments (single or double quotes). This affects both interactive mode and -p mode.
Examples:
Bash(MSBuild.exe *)matchesMSBuild.exe -version✅Bash(MSBuild.exe *)does NOT matchMSBuild.exe "-version"❌Bash(MSBuild.exe *)does NOT matchMSBuild.exe '-version'❌
The only difference is the quotes around the arguments.
What Should Happen?
The wildcard * should match ANY arguments, including quoted arguments like "-p:Configuration=Release". The permission pattern Bash(MSBuild.exe *) should match all of these:
| Command | Current | Expected |
|---------|---------|----------|
| MSBuild.exe -version | ✅ Works | ✅ Works |
| MSBuild.exe "-version" | ❌ Prompts | ✅ Should work |
| MSBuild.exe '-version' | ❌ Prompts | ✅ Should work |
| MSBuild.exe C:/path/file.vcxproj -t:Build | ✅ Works | ✅ Works |
| MSBuild.exe C:/path/file.vcxproj "-t:Build" | ❌ Prompts | ✅ Should work |
Error Messages/Logs
**In interactive mode:** A permission prompt appears asking to allow the command, even though the pattern should match.
**In `-p` mode:** The command is rejected by the permission system entirely. No output is produced; the command simply doesn't execute.
Steps to Reproduce
Environment
- Claude Code version: 2.1.34
- OS: Windows 11 (native, not WSL)
- Shell: Command Prompt (also tested in PowerShell - same behavior)
Configuration
~/.claude/settings.json:
{
"permissions": {
"allow": [
"Bash(MSBuild.exe *)"
]
}
}
Test Commands
Run from any directory:
Test 1: Unquoted arguments - WORKS
claude "run this exact command without changing quotes: MSBuild.exe -version"
Result: No permission prompt ✅
Test 2: Double-quoted arguments - FAILS
claude "run this exact command without changing quotes: MSBuild.exe \"-version\""
Result: Permission prompt appears ❌
Test 3: Single-quoted arguments - FAILS
claude "run this exact command without changing quotes: MSBuild.exe '-version'"
Result: Permission prompt appears ❌
Test 4: Quoted arguments in -p mode - ALSO FAILS
claude -p "run this exact command without changing quotes: MSBuild.exe \"-version\""
Result: Rejected by permission system ❌
Verified Results
| Test | Interactive Mode | -p Mode |
|------|------------------|-----------|
| Unquoted: cmd -flag | ✅ Works | ✅ Works |
| Double-quoted: cmd "-flag" | ❌ Permission prompt | ❌ Permission rejected |
| Single-quoted: cmd '-flag' | ❌ Permission prompt | ❌ Permission rejected |
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.34
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
Impact
This is a significant issue because Claude tends to quote arguments by default. For example, when asked to build a project, Claude generates:
MSBuild.exe project.vcxproj "-p:Configuration=Release" "-p:Platform=x64"
instead of:
MSBuild.exe project.vcxproj -p:Configuration=Release -p:Platform=x64
This makes the permission system much less useful for automation scenarios.
Current Workaround
Add explicit instructions to CLAUDE.md to prevent Claude from quoting arguments:
CRITICAL: Do NOT quote command arguments unless absolutely necessary.
Use: MSBuild.exe -p:Configuration=Release -t:Build
Not: MSBuild.exe "-p:Configuration=Release" "-t:Build"
This workaround is fragile and shouldn't be necessary if the wildcard pattern matched correctly.
Related Issues
- #5503 - Similar report about wildcard matching issues (closed as "Not Planned")
- #581 - Non-interactive mode permission handling
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗