Lightweight coding agent that runs in your terminal
Rust
fix: add true,false,nl to the list of trusted commands (#1676)
Michael Bolinc9e2def49487
diff --git a/codex-rs/core/src/is_safe_command.rs b/codex-rs/core/src/is_safe_command.rsindex 237123c581..493650a4b5 100644--- a/codex-rs/core/src/is_safe_command.rs+++ b/codex-rs/core/src/is_safe_command.rs@@ -23,9 +23,23 @@ fn is_safe_to_call_with_exec(command: &[String]) -> bool {let cmd0 = command.first().map(String::as_str);match cmd0 {- Some("cat" | "cd" | "echo" | "grep" | "head" | "ls" | "pwd" | "tail" | "wc" | "which") => {+ #[rustfmt::skip]+ Some(+ "cat" |+ "cd" |+ "echo" |+ "false" |+ "grep" |+ "head" |+ "ls" |+ "nl" |+ "pwd" |+ "tail" |+ "true" |+ "wc" |+ "which") => {true- }+ },Some("find") => {// Certain options to `find` can delete files, write to files, or@@ -232,6 +246,11 @@ mod tests {assert!(is_safe_to_call_with_exec(&vec_str(&["sed", "-n", "1,5p", "file.txt"])));+ assert!(is_safe_to_call_with_exec(&vec_str(&[+ "nl",+ "-nrz",+ "Cargo.toml"+ ])));// Safe `find` command (no unsafe options).assert!(is_safe_to_call_with_exec(&vec_str(&[