claude-code - 💡(How to fix) Fix [FEATURE] Consolidate exact-match permission entries into patterns

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…

When users approve Bash commands mid-session, each exact command string is appended to settings.local.json. Over multiple sessions this accumulates dozens of one-off entries that provide no security value over a single pattern-based rule.

Root Cause

When users approve Bash commands mid-session, each exact command string is appended to settings.local.json. Over multiple sessions this accumulates dozens of one-off entries that provide no security value over a single pattern-based rule.

Fix Action

Workaround

A Stop hook that restores settings.local.json from a canonical snapshot, discarding accumulated entries. Loses any legitimately new permissions.


This issue was drafted with the help of Claude Code.

Code Example

"Bash(python3 /path/to/script.py --flag1)",
"Bash(python3 /path/to/script.py --flag2)",
"Bash(ENV_VAR=foo bash /path/to/hook.sh)",
"Bash(ENV_VAR=bar bash /path/to/hook.sh)"
RAW_BUFFERClick to expand / collapse

Summary

When users approve Bash commands mid-session, each exact command string is appended to settings.local.json. Over multiple sessions this accumulates dozens of one-off entries that provide no security value over a single pattern-based rule.

Current Behavior

Each approval saves the exact command:

"Bash(python3 /path/to/script.py --flag1)",
"Bash(python3 /path/to/script.py --flag2)",
"Bash(ENV_VAR=foo bash /path/to/hook.sh)",
"Bash(ENV_VAR=bar bash /path/to/hook.sh)"

These are variations of the same intent but stored as separate entries. The file grows unboundedly across sessions.

Desired Behavior

Either (or both):

  1. Pattern inference at approval time — after approving 2-3 similar commands, offer to generalize: "Allow all python3 /path/to/*?"

  2. Session-end consolidation — before persisting, group exact entries sharing a common prefix into a glob pattern.

Workaround

A Stop hook that restores settings.local.json from a canonical snapshot, discarding accumulated entries. Loses any legitimately new permissions.


This issue was drafted with the help of Claude Code.

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