claude-code - 💡(How to fix) Fix Bash permission matcher fails on commands with shell brace expansion [1 comments, 2 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#46785Fetched 2026-04-12 13:33:05
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Author
Timeline (top)
labeled ×5closed ×1commented ×1

Bash permission rules (e.g., Bash(wc *)) fail to match commands that contain shell brace expansion syntax ({a,b,c}), even though the command prefix matches the rule.

Root Cause

Bash permission rules (e.g., Bash(wc *)) fail to match commands that contain shell brace expansion syntax ({a,b,c}), even though the command prefix matches the rule.

Code Example

{
  "permissions": {
    "allow": [
      "Bash(wc *)"
    ]
  }
}

---

wc -l /path/to/file.diff

---

wc -l /path/to/part{1,2,3}.diff
RAW_BUFFERClick to expand / collapse

Description

Bash permission rules (e.g., Bash(wc *)) fail to match commands that contain shell brace expansion syntax ({a,b,c}), even though the command prefix matches the rule.

Steps to Reproduce

  1. Add permission rule to .claude/settings.json:
{
  "permissions": {
    "allow": [
      "Bash(wc *)"
    ]
  }
}
  1. Run a simple command — works, no prompt:
wc -l /path/to/file.diff
  1. Run same command with brace expansion — prompts for permission:
wc -l /path/to/part{1,2,3}.diff

Expected Behavior

Both commands should match Bash(wc *) since they both start with wc . The permission matcher should evaluate against the raw command prefix before considering argument content.

Actual Behavior

The { character in arguments breaks the permission matcher. The user is prompted for permission despite having a matching allow rule.

Additional Notes

  • Also tested Bash(wc:*) (colon prefix syntax) — same behavior, does not match brace expansion commands
  • Commands without braces match correctly with both syntaxes
  • Bash(python3 diff-tools/*) works fine for commands like python3 diff-tools/pipeline.py status 9.00B4 9.00B5 (no braces)

Environment

  • Claude Code CLI
  • macOS (Darwin 25.4.0)

extent analysis

TL;DR

The permission matcher in Claude Code CLI may need to be updated to handle shell brace expansion syntax correctly, allowing commands like wc -l /path/to/part{1,2,3}.diff to match rules like Bash(wc *).

Guidance

  • Verify that the issue is not specific to the wc command by testing other commands with brace expansion, such as ls /path/to/part{1,2,3}.diff, to see if they also fail to match the Bash(*) permission rule.
  • Check the documentation for Claude Code CLI to see if there are any known issues or workarounds for handling shell brace expansion in permission rules.
  • Consider filing a bug report or feature request with the Claude Code CLI developers to improve support for shell brace expansion in permission matching.
  • As a temporary workaround, try adding additional permission rules that explicitly match the commands with brace expansion, such as Bash(wc -l /path/to/part\{1,2,3\}.diff).

Example

No code snippet is provided as the issue is related to the configuration of the Claude Code CLI rather than a specific code example.

Notes

The issue may be specific to the way the Claude Code CLI handles shell brace expansion, and may not be a problem with other similar tools or systems.

Recommendation

Apply workaround: Add additional permission rules that explicitly match the commands with brace expansion, as this is the most straightforward way to address the issue until the underlying problem is fixed.

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 Bash permission matcher fails on commands with shell brace expansion [1 comments, 2 participants]