claude-code - 💡(How to fix) Fix Write/Edit/Read permission allow rules don't match common glob patterns (Bash matcher works) [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#55165Fetched 2026-05-01 05:44:33
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×4closed ×1commented ×1

permissions.allow rules with the Write(...) (and presumably Edit(...) / Read(...)) prefix don't seem to match any of the obvious glob shapes for file paths. Same session, same /hooks reload, the Bash(...) matcher works perfectly with * at any position — so the asymmetry is surprising.

Root Cause

permissions.allow rules with the Write(...) (and presumably Edit(...) / Read(...)) prefix don't seem to match any of the obvious glob shapes for file paths. Same session, same /hooks reload, the Bash(...) matcher works perfectly with * at any position — so the asymmetry is surprising.

Fix Action

Workaround

Drop the Write allow rules entirely. /tmp staging-file workflows then prompt once each — low volume, livable.

Code Example

{
  "permissions": {
    "allow": [
      "Bash(curl *example.com*)",
      "Write(/tmp/anchor-*.json)",
      "Write(/tmp/anchor-*)",
      "Write(/tmp/**)"
    ]
  }
}
RAW_BUFFERClick to expand / collapse

Summary

permissions.allow rules with the Write(...) (and presumably Edit(...) / Read(...)) prefix don't seem to match any of the obvious glob shapes for file paths. Same session, same /hooks reload, the Bash(...) matcher works perfectly with * at any position — so the asymmetry is surprising.

Environment

  • Claude Code: 2.1.123
  • Platform: macOS 15 (Darwin 25.3.0), arm64
  • Settings file: project-level .claude/settings.json

Reproducer

.claude/settings.json (relevant block):

{
  "permissions": {
    "allow": [
      "Bash(curl *example.com*)",
      "Write(/tmp/anchor-*.json)",
      "Write(/tmp/anchor-*)",
      "Write(/tmp/**)"
    ]
  }
}

Steps:

  1. Save settings.json with the rules above.
  2. Run /hooks once mid-session (reloads the config — without this, even Bash rules don't engage at session start, but that's a separate observation).
  3. Have the assistant invoke:
    • Bash: a curl to a host matching example.comauto-allows, no prompt
    • Write: file_path: /tmp/anchor-doublestar-test.json, with arbitrary content → prompts for permission

Expected

Write(/tmp/anchor-*.json) should match /tmp/anchor-doublestar-test.json (single-segment * matches doublestar-test, literal .json suffix matches). At minimum, Write(/tmp/**) should match anything under /tmp/ if the documented gitignore-style semantics hold.

Actual

All three of these prompted in the same session, after /hooks reload, with the Bash control rule auto-allowing:

  • Write(/tmp/anchor-*.json) — literal suffix after *
  • Write(/tmp/anchor-*) — pure trailing *
  • Write(/tmp/**) — gitignore-style recursive double-star

Bash matcher comparison (works correctly)

For contrast, in the same settings file, same session, the Bash matcher matches as documented at any position:

  • Bash(*test-pure-midstring*) denies echo "test-pure-midstring"
  • Bash(echo *test-prefix-mid*) denies echo "test-prefix-mid"
  • Bash(echo test-prefix-only *) denies echo test-prefix-only foo
  • Bash(curl *example.com*) allows a matching curl ✅

Symmetric across allow/deny within Bash.

Question

Either the matcher for Write/Edit/Read doesn't support the same glob semantics as Bash (and the docs should call this out), or there's an actual bug. If the answer is "use Write(<exact-path>) with no globs," that would also be useful to confirm — we'd know to drop these rules and accept the prompts as a known limitation.

Workaround

Drop the Write allow rules entirely. /tmp staging-file workflows then prompt once each — low volume, livable.

extent analysis

TL;DR

The Write permission rules with glob patterns may not be working as expected, and using exact paths or re-evaluating the glob patterns might be necessary.

Guidance

  • Verify the documentation for Write permission rules to ensure that glob patterns are supported and understand the expected behavior.
  • Test Write permission rules with simpler glob patterns or exact paths to isolate the issue.
  • Consider using the workaround of dropping the Write allow rules and accepting the prompts as a known limitation.
  • Compare the behavior of Write permission rules with other permission types, such as Bash, to identify any inconsistencies.

Example

No code snippet is provided as the issue is related to configuration and permission rules.

Notes

The issue may be related to the implementation of glob patterns in Write permission rules, which might not be symmetric with Bash permission rules. Further investigation is needed to determine the root cause.

Recommendation

Apply workaround: Drop the Write allow rules entirely, as this is a known limitation and prompts will be triggered for each write operation, which may be manageable for low-volume workflows.

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 Write/Edit/Read permission allow rules don't match common glob patterns (Bash matcher works) [1 comments, 2 participants]