claude-code - 💡(How to fix) Fix Edit permission glob ** pattern does not recursively match nested directories [5 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#57746Fetched 2026-05-11 03:26:30
View on GitHub
Comments
5
Participants
2
Timeline
11
Reactions
0
Author
Timeline (top)
commented ×5labeled ×4closed ×1cross-referenced ×1

The ** glob pattern in Edit() permission rules (settings.json allow list) does not recursively match files in deeply nested subdirectories. This appears to be a regression -- the same configuration worked in earlier versions.

Root Cause

Root cause hypothesis

Code Example

"Edit(/Users/me/.config/myproject/**)"

---

/Users/me/.config/myproject/worktrees/my-branch/scripts/db.py

---

from pathlib import PurePath

path = PurePath('/Users/me/.config/myproject/worktrees/branch/scripts/file.py')

path.match('/Users/me/.config/myproject/**')        # False (unexpected)
path.match('/Users/me/.config/myproject/*/*/*/*')    # True
RAW_BUFFERClick to expand / collapse

Description

The ** glob pattern in Edit() permission rules (settings.json allow list) does not recursively match files in deeply nested subdirectories. This appears to be a regression -- the same configuration worked in earlier versions.

Reproduction

settings.json allow rule:

"Edit(/Users/me/.config/myproject/**)"

File being edited:

/Users/me/.config/myproject/worktrees/my-branch/scripts/db.py

Expected: Auto-approved (path is under the allowed ** pattern) Actual: Prompts for user approval

Root cause hypothesis

Python's pathlib.PurePath.match() does not support ** for recursive directory matching the way POSIX glob or fnmatch do:

from pathlib import PurePath

path = PurePath('/Users/me/.config/myproject/worktrees/branch/scripts/file.py')

path.match('/Users/me/.config/myproject/**')        # False (unexpected)
path.match('/Users/me/.config/myproject/*/*/*/*')    # True

If Claude Code uses PurePath.match() to evaluate permission patterns, ** will silently fail to match files more than one level deep. fnmatch.fnmatch() handles ** correctly for this case.

Environment

  • Claude Code version: 2.1.133
  • OS: macOS (Darwin 25.4.0)
  • The pattern matches files directly in the allowed directory (1 level deep) but fails for 2+ levels of nesting.

Impact

Users with Edit(/path/**) allow rules get unexpected approval prompts for nested file edits. This affects git worktree workflows where files are several directories deep under the allowed root.

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 Edit permission glob ** pattern does not recursively match nested directories [5 comments, 2 participants]