codex - 💡(How to fix) Fix Feature request: user-selectable approval scopes in command prompts [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
openai/codex#21018Fetched 2026-05-05 05:54:24
View on GitHub
Comments
2
Participants
2
Timeline
7
Reactions
0
Author
Timeline (top)
labeled ×4commented ×2renamed ×1

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 approval prompts are currently too binary and monolithic.

The user can approve or reject the approval unit chosen by the system, but cannot choose the approval 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 approval flow often forces a single system-selected unit. That unit may be too broad, too narrow, or simply the wrong abstraction for persistent approval.

Desired behavior

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

The selectable scopes should be structured approval 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 approval vs persistent approval.

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 approval 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 approval 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 approval flow is too coarse: approve the system-selected unit or reject it. This makes persistent approvals less useful and often encourages overly specific or overly broad rules.

Codex 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 approval flow should be modified to allow users to choose the approval scope from a list of structured approval units, rather than being limited to a single system-selected unit.

Guidance

  • Modify the approval 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 risk level system to categorize commands based on their potential impact, such as low risk, medium risk, high risk, and critical risk.
  • Allow users to choose between one-time and persistent approvals for each scope.

Example

For the command rg --files -g '!node_modules/**', the approval UI could display the following possible scopes:

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

Notes

The implementation of this feature will require significant changes to the approval flow and UI, as well as the development of a risk level system and warning mechanism.

Recommendation

Apply a workaround by modifying the approval UI to display a list of possible scopes and introducing a warning system, as this will allow users to choose the approval scope that best matches their intent and provide more fine-grained control over command approvals.

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

codex - 💡(How to fix) Fix Feature request: user-selectable approval scopes in command prompts [2 comments, 2 participants]