fix(security): allow bare date in default autonomy policy (#2534)

Co-authored-by: Steven Enamakel <enamakel@tinyhumans.ai>
This commit is contained in:
YOMXXX
2026-05-24 23:25:24 -07:00
committed by GitHub
co-authored by Steven Enamakel
parent d0ed10bc6f
commit 147e2bc492
3 changed files with 13 additions and 0 deletions
+1
View File
@@ -60,6 +60,7 @@ fn default_allowed_commands() -> Vec<String> {
"wc".into(),
"head".into(),
"tail".into(),
"date".into(),
"dir".into(),
"type".into(),
"where".into(),
+1
View File
@@ -722,6 +722,7 @@ impl SecurityPolicy {
|| arg == "-c"
})
}
"date" => args.is_empty(),
_ => true,
}
}
+11
View File
@@ -128,6 +128,17 @@ fn config_default_policy_includes_windows_read_equivalents() {
assert!(!p.is_command_allowed("date 2026-05-21"));
}
#[test]
fn config_default_policy_allows_prompt_date_command() {
let cfg = crate::openhuman::config::AutonomyConfig::default();
let p = SecurityPolicy::from_config(&cfg, std::path::Path::new("."));
assert!(
p.is_command_allowed("date"),
"agent instructions use `shell date`, so the default runtime policy must allow it"
);
}
#[test]
fn blocked_commands_basic() {
let p = default_policy();