claude-code - 💡(How to fix) Fix Permission matcher: Bash(rm .tmp/*) doesn't auto-approve matching commands [2 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#46978Fetched 2026-04-13 05:44:44
View on GitHub
Comments
2
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×4commented ×2

Fix Action

Workaround

Use rm -f .tmp/* instead of rm .tmp/*. The -f variant matches correctly.

Code Example

{
  "permissions": {
    "allow": [
      "Bash(rm .tmp/*)",
      "Bash(rm -f .tmp/*)"
    ]
  }
}
RAW_BUFFERClick to expand / collapse

Bug: Bash(rm .tmp/*) allow rule doesn't match rm .tmp/<file> but Bash(rm -f .tmp/*) does

Environment

  • Claude Code: latest (2026-04-12)
  • Model: Opus 4.6 (1M context)
  • OS: macOS Darwin 25.4.0 (aarch64)
  • Shell: zsh, GNU coreutils rm 9.10 (also confirmed with /bin/rm)

Reproduction

settings.json (both global and project-level):

{
  "permissions": {
    "allow": [
      "Bash(rm .tmp/*)",
      "Bash(rm -f .tmp/*)"
    ]
  }
}

Test results:

CommandAllow rulePrompted?
rm .tmp/test1.txtBash(rm .tmp/*)Yes (bug)
rm -f .tmp/test2.txtBash(rm -f .tmp/*)No (correct)
/bin/rm .tmp/file.mdBash(rm .tmp/*)Yes (bug)

Expected behavior

rm .tmp/test1.txt should auto-approve — it matches the pattern Bash(rm .tmp/*).

Actual behavior

Only rm -f .tmp/* auto-approves. Bare rm .tmp/* always prompts despite having an identical allow rule (minus the -f flag).

Diagnostics ruled out

  • No shell alias for rm (type rm → path to binary)
  • No deny rule matching rm .tmp/*
  • No settings.local.json override
  • No PreToolUse hook
  • No entries in /permissions "ask" list
  • File permissions: 644, umask 022
  • Tested with both GNU coreutils rm and macOS /bin/rm — same result

Hypothesis

The permission matcher may have special handling for bare rm <path> (no flags) that bypasses the allow list — possibly an implicit safety heuristic. The -f flag variant is not affected, suggesting the matcher treats rm + immediate path argument differently from rm + flag + path argument.

Workaround

Use rm -f .tmp/* instead of rm .tmp/*. The -f variant matches correctly.

extent analysis

TL;DR

The most likely fix is to use Bash(rm -f .tmp/*) instead of Bash(rm .tmp/*) in the allow rule to ensure auto-approval for rm .tmp/* commands.

Guidance

  • Verify that the permissions settings in settings.json are correctly formatted and applied, ensuring that the allow list is properly configured.
  • Test using Bash(rm -f .tmp/*) as a workaround to confirm that it resolves the auto-approval issue for rm .tmp/* commands.
  • Consider reviewing the documentation for the permission matcher to understand if there are any special handling or implicit safety heuristics for bare rm <path> commands.
  • If the issue persists, try testing with different versions of the rm command or shell to isolate if the problem is specific to the current environment.

Example

No code snippet is provided as the issue is related to configuration and permission matching rather than code execution.

Notes

The provided workaround using Bash(rm -f .tmp/*) may not be ideal for all use cases, as it changes the behavior of the rm command. Further investigation into the permission matcher's behavior may be necessary to determine the root cause of the issue.

Recommendation

Apply the workaround by using Bash(rm -f .tmp/*) in the allow rule, as it has been confirmed to resolve the auto-approval issue for rm .tmp/* commands. This change allows for consistent behavior with the rm command while the underlying issue is further investigated.

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…

FAQ

Expected behavior

rm .tmp/test1.txt should auto-approve — it matches the pattern Bash(rm .tmp/*).

Still need to ship something?

×6

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

Back to top recommendations

TRENDING