Skip to content

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

fix: remove trailing blank lines and reorder test module declarations

Steven Enamakela2a85d1f9cfd
diff --git a/crates/openhuman-core/src/search/tools/parallel/chat.rs b/crates/openhuman-core/src/search/tools/parallel/chat.rs
index 1b5d50e9dc..e1425a46ae 100644
--- a/crates/openhuman-core/src/search/tools/parallel/chat.rs
+++ b/crates/openhuman-core/src/search/tools/parallel/chat.rs
@@ -133,4 +133,3 @@ impl Tool for ParallelChatTool {
}
}
}
-
diff --git a/crates/openhuman-core/src/search/tools/parallel/enrich.rs b/crates/openhuman-core/src/search/tools/parallel/enrich.rs
index 5ae957d26d..a82e27fa4b 100644
--- a/crates/openhuman-core/src/search/tools/parallel/enrich.rs
+++ b/crates/openhuman-core/src/search/tools/parallel/enrich.rs
@@ -167,4 +167,3 @@ impl Tool for ParallelEnrichTool {
}
}
}
-
diff --git a/crates/openhuman-core/src/search/tools/parallel/extract.rs b/crates/openhuman-core/src/search/tools/parallel/extract.rs
index bdfc6a7e39..8aa1a1db9d 100644
--- a/crates/openhuman-core/src/search/tools/parallel/extract.rs
+++ b/crates/openhuman-core/src/search/tools/parallel/extract.rs
@@ -40,7 +40,6 @@ struct ExtractError {
error: String,
}
-
// ── ParallelExtractTool ─────────────────────────────────────────────
/// Extract content from web pages via the Parallel API.
@@ -209,4 +208,3 @@ impl Tool for ParallelExtractTool {
}
}
}
-
diff --git a/crates/openhuman-core/src/search/tools/parallel/research.rs b/crates/openhuman-core/src/search/tools/parallel/research.rs
index 68559e96f7..be4c396992 100644
--- a/crates/openhuman-core/src/search/tools/parallel/research.rs
+++ b/crates/openhuman-core/src/search/tools/parallel/research.rs
@@ -170,4 +170,3 @@ impl Tool for ParallelResearchTool {
}
}
}
-
diff --git a/crates/openhuman-core/src/search/tools/parallel/search.rs b/crates/openhuman-core/src/search/tools/parallel/search.rs
index 09f3eede98..894a68ad38 100644
--- a/crates/openhuman-core/src/search/tools/parallel/search.rs
+++ b/crates/openhuman-core/src/search/tools/parallel/search.rs
@@ -223,4 +223,3 @@ impl Tool for ParallelSearchTool {
}
}
}
-
diff --git a/crates/openhuman-core/src/search/tools/tavily/client.rs b/crates/openhuman-core/src/search/tools/tavily/client.rs
index ae78fbc7d4..5200d59d6e 100644
--- a/crates/openhuman-core/src/search/tools/tavily/client.rs
+++ b/crates/openhuman-core/src/search/tools/tavily/client.rs
@@ -174,10 +174,8 @@ impl TavilyClient {
lines.push(format!(" Score: {score:.3}"));
}
if let Some(excerpt) = item.excerpt() {
- let truncated = crate::util::truncate_with_ellipsis(
- &excerpt,
- SEARCH_EXCERPT_MAX_CHARS,
- );
+ let truncated =
+ crate::util::truncate_with_ellipsis(&excerpt, SEARCH_EXCERPT_MAX_CHARS);
lines.push(format!(" {truncated}"));
}
if include_raw_content {
@@ -247,11 +245,8 @@ impl TavilyClient {
escape_link_destination(&item.url)
));
if let Some(excerpt) = item.excerpt() {
- let truncated = crate::util::truncate_with_suffix(
- &excerpt,
- SEARCH_EXCERPT_MAX_CHARS,
- "...",
- );
+ let truncated =
+ crate::util::truncate_with_suffix(&excerpt, SEARCH_EXCERPT_MAX_CHARS, "...");
out.push_str(&format!("> {truncated}\n"));
}
if include_raw_content {
diff --git a/crates/openhuman-core/src/search/tools/tavily/extract_tool.rs b/crates/openhuman-core/src/search/tools/tavily/extract_tool.rs
index 90d648a878..6b7de3febe 100644
--- a/crates/openhuman-core/src/search/tools/tavily/extract_tool.rs
+++ b/crates/openhuman-core/src/search/tools/tavily/extract_tool.rs
@@ -85,8 +85,7 @@ impl TavilyExtractTool {
));
match non_empty(item.raw_content.as_deref()) {
Some(content) => {
- let truncated =
- crate::util::truncate_with_suffix(&content, 8_000, "...");
+ let truncated = crate::util::truncate_with_suffix(&content, 8_000, "...");
out.push_str(&truncated);
out.push('\n');
}
diff --git a/crates/openhuman-core/src/search/tools/tavily/types.rs b/crates/openhuman-core/src/search/tools/tavily/types.rs
index bbda90c7be..1efac96807 100644
--- a/crates/openhuman-core/src/search/tools/tavily/types.rs
+++ b/crates/openhuman-core/src/search/tools/tavily/types.rs
@@ -6,7 +6,6 @@ use serde_json::{json, Value};
const IMAGE_DESCRIPTION_MAX_CHARS: usize = 300;
-
/// Tavily may return image entries as a bare URL or as an object with an
/// optional description, depending on the endpoint options and API version.
#[derive(Debug, Clone, Deserialize, Serialize)]
@@ -142,7 +141,6 @@ pub(super) fn escape_link_destination(raw: &str) -> String {
format!("<{cleaned}>")
}
-
/// Copy a string array argument onto the Tavily request body.
/// Copy a string array argument onto the Tavily request body.
pub(super) fn copy_domain_filter(args: &Value, from: &str, body: &mut Value) {
diff --git a/crates/openhuman-core/src/security/approval/gate_tests.rs b/crates/openhuman-core/src/security/approval/gate_tests.rs
index 1b11031bab..8a5799d871 100644
--- a/crates/openhuman-core/src/security/approval/gate_tests.rs
+++ b/crates/openhuman-core/src/security/approval/gate_tests.rs
@@ -205,7 +205,7 @@ async fn find_flow_gate_notification(
#[path = "gate_core_flow_tests.rs"]
mod core_flow_tests;
-#[path = "gate_ttl_and_triage_tests.rs"]
-mod ttl_and_triage_tests;
#[path = "gate_origin_intercept_tests.rs"]
mod origin_intercept_tests;
+#[path = "gate_ttl_and_triage_tests.rs"]
+mod ttl_and_triage_tests;
diff --git a/crates/openhuman-core/src/security/approval/store_tests.rs b/crates/openhuman-core/src/security/approval/store_tests.rs
index a72d5f361d..2380926878 100644
--- a/crates/openhuman-core/src/security/approval/store_tests.rs
+++ b/crates/openhuman-core/src/security/approval/store_tests.rs
@@ -105,7 +105,7 @@ fn flow_sample(request_id: &str, flow_id: &str, run_id: &str) -> PendingApproval
})
}
-#[path = "store_persistence_tests.rs"]
-mod persistence_tests;
#[path = "store_flow_trust_tests.rs"]
mod flow_trust_tests;
+#[path = "store_persistence_tests.rs"]
+mod persistence_tests;
diff --git a/crates/openhuman-core/src/security/policy/policy_command/command_name.rs b/crates/openhuman-core/src/security/policy/policy_command/command_name.rs
new file mode 100644
index 0000000000..a02cf7fbd7
--- /dev/null
+++ b/crates/openhuman-core/src/security/policy/policy_command/command_name.rs
@@ -0,0 +1,67 @@
+//! Normalizing a raw command word down to the basename the classifier keys
+//! off, and detecting bases that execute arbitrary code (interpreters,
+//! shells, `xargs`, Windows LOLBins, …).
+
+pub(in crate::security::policy) fn command_basename(command: &str) -> &str {
+ command.split(['/', '\\']).next_back().unwrap_or(command)
+}
+
+pub(in crate::security::policy) fn normalized_command_name(command: &str) -> String {
+ let command = command_basename(command).to_ascii_lowercase();
+ command
+ .strip_suffix(".exe")
+ .unwrap_or(command.as_str())
+ .to_string()
+}
+
+fn is_python_command(command: &str) -> bool {
+ let command = normalized_command_name(command);
+ command == "python"
+ || command == "pythonw"
+ || command
+ .strip_prefix("pythonw")
+ .and_then(|suffix| suffix.chars().next())
+ .is_some_and(|ch| ch.is_ascii_digit())
+ || command
+ .strip_prefix("python")
+ .and_then(|suffix| suffix.chars().next())
+ .is_some_and(|ch| ch.is_ascii_digit())
+}
+
+pub(in crate::security::policy) fn is_command_executor(command: &str) -> bool {
+ let command = normalized_command_name(command);
+ is_python_command(command.as_str())
+ || matches!(
+ command.as_str(),
+ "xargs"
+ | "awk"
+ | "gawk"
+ | "mawk"
+ | "nawk"
+ | "perl"
+ | "ruby"
+ | "bash"
+ | "sh"
+ | "dash"
+ | "zsh"
+ | "ksh"
+ | "fish"
+ | "env"
+ // JS/TS runtimes (the `node_exec`/`npm_exec` shell equivalents)
+ | "node"
+ | "nodejs"
+ | "deno"
+ | "bun"
+ // Windows / PowerShell arbitrary-code launchers + LOLBins
+ | "iex"
+ | "invoke-expression"
+ | "cmd"
+ | "pwsh"
+ | "powershell"
+ | "wscript"
+ | "cscript"
+ | "mshta"
+ | "rundll32"
+ | "start-process"
+ )
+}