openai / openai/codex

Ability to add exceptions to prefix_rule forbid/prompt

Open
#45,756 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

CLI enhancement sandbox
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What variant of Codex are you using?

CLI

What feature would you like to see?

Currently, more restrictive rules always have higher priority than less restrictive rules, so for example a rule that forbids, or requires a prompt for commands that start with "cmd" will have higher priority than a rule that allows ["cmd", "subcommand"].

This effectively makes it impossible to express something like "require a prompt for any command that starts with X, unless it uses one of these subcommands".

As a concrete example, I would like to require a prompt for most tofu commands, but want to allow a subset of them (tofu fmt and tofu validate), but there isn't a good way to do this.

Additional information

One seeming workaround for this is to use a denylist of subcommands to block. However, this is lest effective than one would hope, because it is trivial to bypass it by putting an option between the main command and the subcommand so the prefix doesn't match. That problem could possibly be worked around if prefix_rule had some form of wildcard matching and/or a way to tell it to ignore options starting wtih "-" (at least for some use cases).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the CLI's prefix_rule evaluation and how restrictive rules are prioritized. Define how exceptions should interact with forbid and prompt rules, including the tofu fmt and tofu validate examples, then verify the chosen behavior against option placement and rule-matching cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.