claude-code - 💡(How to fix) Fix [Bug] Permission pattern matching fails when `:*` suffix follows another `*` wildcard [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#56871Fetched 2026-05-07 03:43:12
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×4

Root Cause

Bug Description The docs at https://code.claude.com/docs/en/permissions state:

▎ "The :* suffix is an equivalent way to write a trailing wildcard, so Bash(ls:*) matches the same commands as Bash(ls *)."

Empirically, this equivalence breaks when the pattern contains another * earlier in the string. The :* form silently fails to match; replacing :* with * (no space) or * (with space) makes it match.

Repro (Claude Code 2.1.132, Linux):

mkdir -p /tmp/perm-test && cd /tmp/perm-test

Helper that runs claude with one rule and dontAsk mode.

test_rule() { claude --setting-sources project
--settings "{"permissions":{"allow":["$1"]}}"
--permission-mode dontAsk -p
"Use the Bash tool to run exactly: $2. Then print MATCHED or NO_MATCH." }

test_rule 'Bash(git -C * show:)' 'git -C /tmp show HEAD' # NO_MATCH (bug) test_rule 'Bash(git -C * show)' 'git -C /tmp show HEAD' # MATCHED test_rule 'Bash(git -C * show )' 'git -C /tmp show HEAD' # MATCHED test_rule 'Bash(git -C /tmp show:)' 'git -C /tmp show HEAD' # MATCHED (no mid-pattern *)

Expected: Bash(git -C * show:) matches per the documented : ≡ * equivalence. Actual: It doesn't, while the otherwise-equivalent * and * forms do.

Impact: Anyone writing rules of the shape Bash(<cmd> * <subcmd>:) (a common pattern, e.g. git -C * <subcmd>: for cross-repo work) silently gets prompted for every invocation. The bug is hard to diagnose because the documented behavior says it should work.

Code Example

[]
RAW_BUFFERClick to expand / collapse

Bug Description The docs at https://code.claude.com/docs/en/permissions state:

▎ "The :* suffix is an equivalent way to write a trailing wildcard, so Bash(ls:*) matches the same commands as Bash(ls *)."

Empirically, this equivalence breaks when the pattern contains another * earlier in the string. The :* form silently fails to match; replacing :* with * (no space) or * (with space) makes it match.

Repro (Claude Code 2.1.132, Linux):

mkdir -p /tmp/perm-test && cd /tmp/perm-test

Helper that runs claude with one rule and dontAsk mode.

test_rule() { claude --setting-sources project
--settings "{"permissions":{"allow":["$1"]}}"
--permission-mode dontAsk -p
"Use the Bash tool to run exactly: $2. Then print MATCHED or NO_MATCH." }

test_rule 'Bash(git -C * show:)' 'git -C /tmp show HEAD' # NO_MATCH (bug) test_rule 'Bash(git -C * show)' 'git -C /tmp show HEAD' # MATCHED test_rule 'Bash(git -C * show )' 'git -C /tmp show HEAD' # MATCHED test_rule 'Bash(git -C /tmp show:)' 'git -C /tmp show HEAD' # MATCHED (no mid-pattern *)

Expected: Bash(git -C * show:) matches per the documented : ≡ * equivalence. Actual: It doesn't, while the otherwise-equivalent * and * forms do.

Impact: Anyone writing rules of the shape Bash(<cmd> * <subcmd>:) (a common pattern, e.g. git -C * <subcmd>: for cross-repo work) silently gets prompted for every invocation. The bug is hard to diagnose because the documented behavior says it should work.

Environment Info

  • Platform: linux
  • Terminal: tmux
  • Version: 2.1.132
  • Feedback ID: 72014e2a-cb7a-4226-974f-38a8971c7996

Errors

[]

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [Bug] Permission pattern matching fails when `:*` suffix follows another `*` wildcard [1 participants]