mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-29 14:02:19 +00:00
fix(security): allow bare date in default autonomy policy (#2534)
Co-authored-by: Steven Enamakel <enamakel@tinyhumans.ai>
This commit is contained in:
co-authored by
Steven Enamakel
parent
d0ed10bc6f
commit
147e2bc492
@@ -60,6 +60,7 @@ fn default_allowed_commands() -> Vec<String> {
|
||||
"wc".into(),
|
||||
"head".into(),
|
||||
"tail".into(),
|
||||
"date".into(),
|
||||
"dir".into(),
|
||||
"type".into(),
|
||||
"where".into(),
|
||||
|
||||
@@ -722,6 +722,7 @@ impl SecurityPolicy {
|
||||
|| arg == "-c"
|
||||
})
|
||||
}
|
||||
"date" => args.is_empty(),
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user