Skip to content

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

test(security): cover quoted operators and process substitution

Steven Enamakel440fc056919b
diff --git a/crates/openhuman-core/src/security/policy/policy_injection_tests.rs b/crates/openhuman-core/src/security/policy/policy_injection_tests.rs
index cb93621e0e..c11f7df924 100644
--- a/crates/openhuman-core/src/security/policy/policy_injection_tests.rs
+++ b/crates/openhuman-core/src/security/policy/policy_injection_tests.rs
@@ -16,6 +16,13 @@ fn command_injection_redirect_blocked() {
assert!(!p.is_command_allowed("ls >> /tmp/exfil.txt"));
}
+#[test]
+fn quoted_ampersand_and_redirect_literals_are_not_treated_as_operators() {
+ let p = default_policy();
+ assert!(p.is_command_allowed("echo \"A&B\""));
+ assert!(p.is_command_allowed("echo \"A>B\""));
+}
+
#[test]
fn command_argument_injection_blocked() {
let p = default_policy();
@@ -153,6 +160,13 @@ fn command_injection_tee_blocked() {
assert!(!p.is_command_allowed("tee file.txt"));
}
+#[test]
+fn command_injection_process_substitution_blocked() {
+ let p = default_policy();
+ assert!(!p.is_command_allowed("cat <(echo pwned)"));
+ assert!(!p.is_command_allowed("ls >(cat /etc/passwd)"));
+}
+
#[test]
fn command_env_var_prefix_is_always_rejected() {
let p = default_policy();