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 versioned and .exe command executors
Steven Enamakelc6611b8be3e6
diff --git a/crates/openhuman-core/src/security/policy/command_analysis.rs b/crates/openhuman-core/src/security/policy/command_analysis.rsindex c8eee4a121..38c47c5858 100644--- a/crates/openhuman-core/src/security/policy/command_analysis.rs+++ b/crates/openhuman-core/src/security/policy/command_analysis.rs@@ -81,22 +81,7 @@ impl CommandAnalysis {| "PATH")});- let executor = matches!(- normalized_name.as_str(),- "sh" | "bash"- | "zsh"- | "fish"- | "python"- | "python2"- | "python3"- | "node"- | "ruby"- | "perl"- | "php"- | "lua"- | "awk"- | "xargs"- );+ let executor = is_command_executor_name(&normalized_name);let class = classify_host_command(&normalized_name, &arguments, &lower);analysis.hidden_execution |= lower.contains("$(")|| lower.contains("<(")@@ -212,3 +197,36 @@ pub(super) fn classify_host_command(base: &str, args: &[String], source: &str) -}CommandClass::Write}++pub(super) fn is_command_executor_name(name: &str) -> bool {+ let name = name.strip_suffix(".exe").unwrap_or(name);+ let python = ["pythonw", "python"]+ .iter()+ .any(|prefix| is_versioned_executable(name, prefix));+ python+ || matches!(+ name,+ "sh" | "bash"+ | "zsh"+ | "fish"+ | "node"+ | "ruby"+ | "perl"+ | "php"+ | "lua"+ | "awk"+ | "xargs"+ )+}++fn is_versioned_executable(name: &str, prefix: &str) -> bool {+ let Some(suffix) = name.strip_prefix(prefix) else {+ return false;+ };+ suffix.is_empty()+ || (suffix.starts_with(|character: char| character.is_ascii_digit())+ && suffix+ .chars()+ .all(|character| character.is_ascii_digit() || character == '.')+ && !suffix.ends_with('.'))+}diff --git a/crates/openhuman-core/src/security/policy/command_checks.rs b/crates/openhuman-core/src/security/policy/command_checks.rsindex 1b3fad02fb..ab16fb06da 100644--- a/crates/openhuman-core/src/security/policy/command_checks.rs+++ b/crates/openhuman-core/src/security/policy/command_checks.rs@@ -90,22 +90,7 @@ fn has_hidden_execution(command: &str) -> bool {#[cfg(test)]fn is_command_executor(command: &str) -> bool {- matches!(- command,- "sh" | "bash"- | "zsh"- | "fish"- | "python"- | "python2"- | "python3"- | "node"- | "ruby"- | "perl"- | "php"- | "lua"- | "awk"- | "xargs"- )+ super::command_analysis::is_command_executor_name(command)}#[cfg(test)]