claude-code - 💡(How to fix) Fix Feature request: user-selectable permission scopes in command prompts [1 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#56058Fetched 2026-05-05 05:59:18
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×3

Error Message

  • approving only an executable name can warn that this is broader than approving a subcommand or exact argument set;
  • approving a package-manager script can warn that the script body may change;
  • approving a shell interpreter or shell-wrapped invocation can warn that this is a broad executable-code boundary;
  • approving a multi-command sequence can warn that future matching commands may run multiple commands;
  • approving redirection can warn about file writes;
  • approving destructive commands can warn about file deletion risk;
  • approving network/install commands can warn about supply-chain or download risk.

Code Example

rg --files -g '!node_modules/**'

---

rg --files -g '!node_modules/**'

---

git -c safe.directory=C:/projects/md2pdf diff --check

---

npm run build -- --mode production

---

rg foo . | sort > results.txt

---

cd repo; npm test

---

bash -lc 'cmd1 && cmd2'
RAW_BUFFERClick to expand / collapse

Problem

Command permission prompts are currently too binary and monolithic.

The user can approve or reject the permission unit chosen by the system, but cannot choose the permission scope that best matches their intent.

This is not limited to commands composed with shell operators. It also applies to the arguments of a single command.

For example, if the requested command is:

rg --files -g '!node_modules/**'

the user may want to approve one of several different scopes:

  • rg
  • rg --files
  • rg --files -g '!node_modules/**'
  • this exact invocation only

The same applies to command sequences, pipelines, shell wrappers, environment variables, working directories, paths, and command-specific subcommands.

Today, the permission flow often forces a single system-selected unit. That unit may be too broad, too narrow, or simply the wrong abstraction for persistent permission.

Desired behavior

The permission UI should let the user choose the permission scope.

The selectable scopes should be structured permission units, not arbitrary substrings. They should reflect how the command will execute and how users naturally reason about command permissions.

Useful scope dimensions include:

  • exact invocation;
  • executable/program name;
  • subcommand or action;
  • selected flags and option values;
  • positional arguments;
  • file/path arguments;
  • working directory;
  • environment variables;
  • shell wrapper, when present;
  • command sequences such as cmd1; cmd2;
  • conditional sequences such as cmd1 && cmd2 or cmd1 || cmd2;
  • pipelines such as cmd1 | cmd2;
  • redirection such as > or >>;
  • one-time permission vs persistent permission.

The important part is that the human chooses the abstraction being authorized.

Examples

For:

rg --files -g '!node_modules/**'

possible scopes could include:

  • rg
  • rg --files
  • rg --files -g '!node_modules/**'
  • exact invocation

For:

git -c safe.directory=C:/projects/md2pdf diff --check

possible scopes could include:

  • git
  • git diff
  • git diff --check
  • git -c safe.directory=C:/projects/md2pdf diff --check
  • exact invocation

For:

npm run build -- --mode production

possible scopes could include:

  • npm
  • npm run
  • npm run build
  • npm run build -- --mode production
  • exact invocation

For:

rg foo . | sort > results.txt

possible scopes could include:

  • rg foo .
  • rg foo . | sort
  • rg foo . | sort > results.txt
  • exact invocation

For:

cd repo; npm test

possible scopes could include:

  • cd repo
  • cd repo; npm test
  • exact invocation

For a shell-wrapped command:

bash -lc 'cmd1 && cmd2'

possible scopes could include:

  • the shell wrapper invocation;
  • the inner executable step;
  • the inner composed sequence;
  • exact invocation.

Safety model

The permission UI can show risk warnings for broader or riskier scopes, but warnings should not be hard blocks.

For example:

  • approving only an executable name can warn that this is broader than approving a subcommand or exact argument set;
  • approving a package-manager script can warn that the script body may change;
  • approving a shell interpreter or shell-wrapped invocation can warn that this is a broad executable-code boundary;
  • approving a multi-command sequence can warn that future matching commands may run multiple commands;
  • approving redirection can warn about file writes;
  • approving destructive commands can warn about file deletion risk;
  • approving network/install commands can warn about supply-chain or download risk.

The user should still be able to explicitly approve after seeing the warning.

Useful risk levels could include:

  • low risk: read-only commands like rg, git status, git diff;
  • medium risk: build/test commands, generators, package scripts;
  • high risk: shell interpreters, deletion, network install, privilege changes;
  • critical risk: recursive delete, credential access, system configuration changes.

Rationale

The human operator often understands the intended permission boundary better than an automatic matcher.

The system does not need to perfectly parse every command and silently decide the right policy. It can expose useful candidate scopes and let the user choose.

Today, the permission flow is too coarse: approve the system-selected unit or reject it. This makes persistent permissions less useful and often encourages overly specific or overly broad rules.

Claude Code should let the human choose which command abstraction is being authorized, with proportional warnings and an explicit one-time vs persistent choice.

extent analysis

TL;DR

The permission system should be modified to allow users to choose the permission scope from a list of structured permission units, rather than relying on a single system-selected unit.

Guidance

  • Modify the permission UI to display a list of possible scopes for each command, including exact invocation, executable/program name, subcommand or action, and other relevant dimensions.
  • Implement a warning system to alert users to potential risks associated with broader or riskier scopes, but allow them to explicitly approve after seeing the warning.
  • Introduce a distinction between one-time and persistent permissions to give users more control over command authorization.
  • Consider implementing a risk level system to categorize commands as low, medium, high, or critical risk, and display corresponding warnings to users.

Example

# Example of possible scopes for a command
scopes = [
  "rg",
  "rg --files",
  "rg --files -g '!node_modules/**'",
  "exact invocation"
]

# Example of warning system
if scope == "rg":
  warning = "Approving only the executable name may be broader than intended"

Notes

The implementation of this feature will require significant changes to the permission system and UI. It is essential to carefully consider the trade-offs between security and usability when designing the warning system and risk levels.

Recommendation

Apply a workaround by modifying the permission UI to display a list of possible scopes and implementing a warning system, as this will provide users with more control over command authorization and improve the overall security of the system.

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