The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(security): detect env-wrapped executors and more destructive commands
Steven Enamakeldebcb0d90a60
diff --git a/crates/openhuman-core/src/security/policy/command_analysis.rs b/crates/openhuman-core/src/security/policy/command_analysis.rsindex 38c47c5858..d99f0c3de1 100644--- a/crates/openhuman-core/src/security/policy/command_analysis.rs+++ b/crates/openhuman-core/src/security/policy/command_analysis.rs@@ -81,7 +81,11 @@ impl CommandAnalysis {| "PATH")});- let executor = is_command_executor_name(&normalized_name);+ let executor = is_command_executor_name(&normalized_name)+ || normalized_name == "env"+ && arguments+ .iter()+ .any(|argument| is_command_executor_name(argument));let class = classify_host_command(&normalized_name, &arguments, &lower);analysis.hidden_execution |= lower.contains("$(")|| lower.contains("<(")@@ -143,6 +147,8 @@ pub(super) fn classify_host_command(base: &str, args: &[String], source: &str) -| "userdel"| "usermod"| "passwd"+ | "format"+ | "diskpart") || source.contains("rm -rf /")|| source.contains("rm -fr /")|| source.contains(":(){:|:&};:")@@ -151,11 +157,34 @@ pub(super) fn classify_host_command(base: &str, args: &[String], source: &str) -}if matches!(base,- "curl" | "wget" | "ssh" | "scp" | "sftp" | "ftp" | "telnet" | "nc" | "ncat" | "netcat"+ "curl"+ | "wget"+ | "ssh"+ | "scp"+ | "sftp"+ | "ftp"+ | "telnet"+ | "nc"+ | "ncat"+ | "netcat"+ | "invoke-webrequest"+ | "invoke-restmethod"+ | "iwr"+ | "irm") {return CommandClass::Network;}let first = args.first().map(String::as_str).unwrap_or_default();+ if base == "find"+ && args.iter().any(|argument| {+ matches!(+ argument.as_str(),+ "-delete" | "-fprint" | "-fprint0" | "-fprintf" | "-fls"+ )+ })+ {+ return CommandClass::Write;+ }let global_flag = args.iter().any(|arg| matches!(arg.as_str(), "-g" | "--global"));diff --git a/crates/openhuman-core/src/security/policy/command_checks.rs b/crates/openhuman-core/src/security/policy/command_checks.rsindex ab16fb06da..1299915b4e 100644--- a/crates/openhuman-core/src/security/policy/command_checks.rs+++ b/crates/openhuman-core/src/security/policy/command_checks.rs@@ -192,7 +192,12 @@ impl SecurityPolicy {let base = normalized_command_name(base_raw);- let args: Vec<String> = words.map(|w| w.to_ascii_lowercase()).collect();+ let args: Vec<String> = words+ .map(|word| {+ word.trim_matches(|character: char| matches!(character, '\'' | '"'))+ .to_ascii_lowercase()+ })+ .collect();let joined_segment = cmd_part.to_ascii_lowercase();// High-risk = catastrophic / irreversible / privilege-escalating /@@ -271,7 +276,9 @@ impl SecurityPolicy {// Interpreters / code executors run arbitrary code — medium-risk// (that is the job of a coding agent): prompted in Supervised,// allowed in Full. They are no longer classified high-risk.- let medium = medium || is_command_executor(base.as_str());+ let medium = medium+ || is_command_executor(base.as_str())+ || base == "env" && args.iter().any(|arg| is_command_executor(arg));saw_medium |= medium;}