Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(security): cover supervised autonomy command analysis

Steven Enamakel36933943561a
diff --git a/crates/openhuman-core/src/security/policy/policy_paths_and_risk_tests.rs b/crates/openhuman-core/src/security/policy/policy_paths_and_risk_tests.rs
index f9d7c83359..aad6dd6f82 100644
--- a/crates/openhuman-core/src/security/policy/policy_paths_and_risk_tests.rs
+++ b/crates/openhuman-core/src/security/policy/policy_paths_and_risk_tests.rs
@@ -96,6 +96,32 @@ fn tinybox_command_facts_drive_policy_and_keep_the_path_floor_when_disabled() {
background: false,
literal_words: vec!["ls".into(), "-la".into()],
};
+ let supervised = SecurityPolicy {
+ enabled: true,
+ autonomy: AutonomyLevel::Supervised,
+ ..SecurityPolicy::default()
+ };
+ assert!(supervised.is_command_allowed_analysis(&analysis));
+ assert!(!supervised.is_command_allowed_analysis(&CommandAnalysis {
+ redirection: true,
+ ..analysis.clone()
+ }));
+ assert!(!supervised.is_command_allowed_analysis(&CommandAnalysis {
+ segments: vec![CommandSegment {
+ leading_env_assignment: true,
+ ..analysis.segments[0].clone()
+ }],
+ ..analysis.clone()
+ }));
+ assert!(!supervised.is_command_allowed_analysis(&CommandAnalysis {
+ segments: vec![CommandSegment {
+ normalized_name: "python3".into(),
+ executor: true,
+ ..analysis.segments[0].clone()
+ }],
+ ..analysis.clone()
+ }));
+
let readonly = SecurityPolicy {
enabled: true,
autonomy: AutonomyLevel::ReadOnly,