-
Notifications
You must be signed in to change notification settings - Fork 6.8k
execpolicy2 extension #6627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
execpolicy2 extension #6627
Conversation
|
@codex review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| /// Evaluate a command against a policy. | ||
| Check { | ||
| #[arg(short, long, value_name = "PATH")] | ||
| policy: PathBuf, | ||
| #[arg(short, long, value_name = "PATH", required = true)] | ||
| policies: Vec<PathBuf>, | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preserve --policy CLI flag name
Renaming the field from policy to policies in the Clap definition changed the generated long option to --policies, because #[arg(long)] derives the flag name from the field identifier. The README and existing CLI usage still rely on --policy, so the sample command (cargo run … -- check --policy …) now fails with “found argument '--policy' which wasn't expected”, and any automation using the old flag breaks. Please keep the long name stable by explicitly setting long = "policy" (or by keeping the field name singular) so the CLI remains backward compatible while still accepting multiple paths.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this crate hasn't been merged yet. we are free to make breaking changes
35f3561 to
ce220f0
Compare
784ce0d to
bdb5210
Compare
codex-rs/execpolicy2/tests/basic.rs
Outdated
| prefix_rule( | ||
| pattern = ["git", "status"], | ||
| decision = "allow", | ||
| ) | ||
| prefix_rule( | ||
| pattern = ["git"], | ||
| decision = "prompt", | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the decision for git status: is it prompt because that's stricter than allow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it should be prompt!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that make the git status rule useless? How would it ever be allowed?
ce220f0 to
ce50c94
Compare
636cb31 to
340895f
Compare
ce50c94 to
94d2943
Compare
340895f to
51249c8
Compare
51249c8 to
c14008b
Compare
c14008b to
43ca23f
Compare
codex-rs/execpolicy2/tests/basic.rs
Outdated
| prefix_rule( | ||
| pattern = ["git", "status"], | ||
| decision = "allow", | ||
| ) | ||
| prefix_rule( | ||
| pattern = ["git"], | ||
| decision = "prompt", | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that make the git status rule useless? How would it ever be allowed?
|
@bolinfest (not sure why it's not letting me reply) -- fixed the git status test case to be more realistic as well |
codex-rs/execpolicy2/tests/basic.rs
Outdated
| #[test] | ||
| fn strictest_decision_across_multiple_commands() { | ||
| let policy_src = r#" | ||
| prefix_rule( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, remove this and change ["git"] to "prompt".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is done!
Policy(useful if codex detects many.codexpolicyfiles)Policyto allow evaluation of multiple cmds at once (useful when we have chained commands)