feat: introduce codex_execpolicy crate for defining "safe" commands

This commit is contained in:
Michael Bolin
2025-04-24 17:07:37 -07:00
parent 61805a832d
commit 687dc8b68b
29 changed files with 3830 additions and 47 deletions
@@ -0,0 +1,23 @@
use codex_execpolicy::parse_sed_command;
use codex_execpolicy::Error;
#[test]
fn parses_simple_print_command() {
assert_eq!(parse_sed_command("122,202p"), Ok(()));
}
#[test]
fn rejects_malformed_print_command() {
assert_eq!(
parse_sed_command("122,202"),
Err(Error::SedCommandNotProvablySafe {
command: "122,202".to_string(),
})
);
assert_eq!(
parse_sed_command("122202"),
Err(Error::SedCommandNotProvablySafe {
command: "122202".to_string(),
})
);
}