Skip to content

fix(permissions): load no allow rule from a colon-spelled catch-all - #5021

Open
KuSh wants to merge 1 commit into
rtk-ai:developfrom
KuSh:fix/permission-wildcard-spellings
Open

KuSh wants to merge 1 commit into
rtk-ai:developfrom
KuSh:fix/permission-wildcard-spellings

Conversation

@KuSh

@KuSh KuSh commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

With Bash(:*) or Bash(*:*) in permissions.allow, the Claude hook auto-approves every command it rewrites, while Claude Code on its own prompts, and under -p the tool call doesn't run. RTK's matcher reads these spellings as wildcards, which is right for a deny or ask rule and too generous for an allow rule.

The Claude settings loader now skips an allow rule that names no command and spells its wildcard with a colon, so Claude Code keeps that decision. Hosts that read Claude's settings through this loader get the same rules.

Unchanged: * and **, which Claude Code does read as every command; rules naming a command such as git:*; deny and ask rules; Cursor's and Gemini's own rules.

Measured

Claude Code 2.1.318 in -p mode against a mock API, one scripted git status && touch marker:

allow rule without RTK develop this PR
Bash(*) runs runs runs
Bash(**) runs runs runs
Bash(git:*), Bash(touch:*) runs runs runs
Bash(:*) stopped runs stopped
Bash(*:*) stopped runs stopped
Bash(*:**) stopped runs stopped

Not in this PR

Rules that name a command can still read wider than Claude Code does, for example Bash(*:rm) or Bash(git -C * status:*), which #1105 asked for. That needs a stricter allow reading rather than a list of spellings. How Cursor and Gemini read these spellings wasn't checked.

Test plan

  • cargo fmt --all, cargo clippy --all-targets, cargo test --all, and both with --no-default-features
  • Each clause of the check fails a test when removed
  • rtk hook claude and rtk rewrite end to end in tests/hook_decision_protocol_test.rs

🤖 Generated with Claude Code

Rule matching reads `:*`, `*:*`, `::*` and `*:**` as broad wildcards. That errs on the
safe side for a deny or ask rule. As an allow rule it made the Claude hook auto-approve
what it rewrites, while Claude Code does not read them as every command, so without RTK
the same settings prompt, and under `-p` the tool call does not run.

The Claude settings loader now skips an allow rule that names no command and spells its
wildcard with a colon, and Claude Code keeps that decision. Hosts that read Claude's
settings through this loader get the same rules. `*` and `**`, which Claude Code does
read as every command, and rules naming a command such as `git:*`, still allow. Deny and
ask rules keep the broad reading, and Cursor's and Gemini's own rules are untouched.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟢 Risk low

Summary

Fixes RTK's Claude settings loader so colon-spelled catch-all patterns (:*, *:*, ::*, *:**) in permissions.allow are no longer loaded as allow rules, since Claude Code itself doesn't treat these as wildcards matching every command. Previously RTK's hook would auto-approve commands under these rules when Claude Code would still prompt, creating an over-permissive gap; deny/ask rules and plain */** wildcards are unaffected.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Analyzed automatically by wshm · This is an automated analysis, not a human review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant