adding execpolicycheck tool onto codex cli this is useful for validating policies (can be multiple) against commands. it will also surface errors in policy syntax: <img width="1150" height="281" alt="Screenshot 2025-11-19 at 12 46 21 PM" src="https://github.com/user-attachments/assets/8f99b403-564c-4172-acc9-6574a8d13dc3" /> this PR also changes output format when there's no match in the CLI. instead of returning the raw string `noMatch`, we return `{"noMatch":{}}` this PR is a rewrite of: https://github.com/openai/codex/pull/6932 (due to the numerous merge conflicts present in the original PR) --------- Co-authored-by: Michael Bolin <mbolin@openai.com>
22 lines
468 B
Rust
22 lines
468 B
Rust
use anyhow::Result;
|
|
use clap::Parser;
|
|
use codex_execpolicy::ExecPolicyCheckCommand;
|
|
|
|
/// CLI for evaluating exec policies
|
|
#[derive(Parser)]
|
|
#[command(name = "codex-execpolicy")]
|
|
enum Cli {
|
|
/// Evaluate a command against a policy.
|
|
Check(ExecPolicyCheckCommand),
|
|
}
|
|
|
|
fn main() -> Result<()> {
|
|
let cli = Cli::parse();
|
|
match cli {
|
|
Cli::Check(cmd) => cmd_check(cmd),
|
|
}
|
|
}
|
|
|
|
fn cmd_check(cmd: ExecPolicyCheckCommand) -> Result<()> {
|
|
cmd.run()
|
|
}
|