diff --git a/codex-rs/core/src/exec_policy.rs b/codex-rs/core/src/exec_policy.rs index de21b8aa3..3cc83c4a4 100644 --- a/codex-rs/core/src/exec_policy.rs +++ b/codex-rs/core/src/exec_policy.rs @@ -35,6 +35,54 @@ const PROMPT_CONFLICT_REASON: &str = const RULES_DIR_NAME: &str = "rules"; const RULE_EXTENSION: &str = "rules"; const DEFAULT_POLICY_FILE: &str = "default.rules"; +static BANNED_PREFIX_SUGGESTIONS: &[&[&str]] = &[ + &["python3"], + &["python3", "-"], + &["python3", "-c"], + &["python"], + &["python", "-"], + &["python", "-c"], + &["py"], + &["py", "-3"], + &["pythonw"], + &["pyw"], + &["pypy"], + &["pypy3"], + &["git"], + &["bash"], + &["bash", "-lc"], + &["sh"], + &["sh", "-c"], + &["sh", "-lc"], + &["zsh"], + &["zsh", "-lc"], + &["/bin/zsh"], + &["/bin/zsh", "-lc"], + &["/bin/bash"], + &["/bin/bash", "-lc"], + &["pwsh"], + &["pwsh", "-Command"], + &["pwsh", "-c"], + &["powershell"], + &["powershell", "-Command"], + &["powershell", "-c"], + &["powershell.exe"], + &["powershell.exe", "-Command"], + &["powershell.exe", "-c"], + &["env"], + &["sudo"], + &["node"], + &["node", "-e"], + &["perl"], + &["perl", "-e"], + &["ruby"], + &["ruby", "-e"], + &["php"], + &["php", "-r"], + &["lua"], + &["lua", "-e"], + &["osascript"], +]; fn is_policy_match(rule_match: &RuleMatch) -> bool { match rule_match { @@ -240,6 +288,10 @@ pub async fn load_exec_policy(config_stack: &ConfigLayerStack) -> Result Result