Permission pattern `Bash(gh pr view :*)` fails to match commands with `--json` flag
Description
The permission pattern Bash(gh pr view :*) in ~/.claude/settings.json fails to match commands that include the --json flag with comma-separated values, such as:
gh pr view 379 --json title,body,state,author,commits,files
Claude Code prompts for permission even though this command should be covered by the :* wildcard pattern.
Expected Behavior
The pattern Bash(gh pr view :*) should match any gh pr view command followed by any arguments, including those with --json flags.
Actual Behavior
Claude Code requests permission for the command despite the pattern being in the allow list.
Workaround
Adding a more specific pattern works:
"Bash(gh pr view :* --json :*)"
However, this should not be necessary given that :* is supposed to match any arguments.
Configuration
{
"permissions": {
"allow": [
"Bash(gh pr view)",
"Bash(gh pr view :*)"
]
}
}
Related Issues
This appears to be another instance of a broader pattern matching problem reported in:
- #6798 - kubectl patterns not matching (e.g.,
Bash(kubectl *get*)doesn't matchkubectl get pods) - #5503 - PHP commands with complex arguments not matching (e.g.,
Bash(php:*)doesn't match PHP commands with quotes) - #2719 - Curl wildcard matching failures (comprehensive wildcards still don't match curl commands)
All of these describe the same underlying bug where :* wildcard patterns fail to match commands with certain argument patterns.
Additional Context
The pattern matching system documentation states that :* provides prefix matching for any arguments, but this doesn't appear to work correctly when the arguments include certain flag combinations.
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗