Skip to content

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

fix(security): normalize command names before executor checks

Steven Enamakelbf7dd449a6c8
diff --git a/crates/openhuman-core/src/security/policy/command_checks.rs b/crates/openhuman-core/src/security/policy/command_checks.rs
index 3171babdde..339e647178 100644
--- a/crates/openhuman-core/src/security/policy/command_checks.rs
+++ b/crates/openhuman-core/src/security/policy/command_checks.rs
@@ -90,10 +90,12 @@ fn has_hidden_execution(command: &str) -> bool {
#[cfg(test)]
fn is_command_executor(command: &str) -> bool {
- let command = command.strip_suffix(".exe").unwrap_or(command);
+ let command = command_basename(command.trim_matches(|c: char| matches!(c, '\'' | '"')))
+ .to_ascii_lowercase();
+ let command = command.strip_suffix(".exe").unwrap_or(&command);
let python_executor = command
- .strip_prefix("python")
- .or_else(|| command.strip_prefix("pythonw"))
+ .strip_prefix("pythonw")
+ .or_else(|| command.strip_prefix("python"))
.is_some_and(|version| {
version.is_empty()
|| version