Skip to content

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

test(skills): agent install tools cannot acknowledge scan findings (#7082)

oxoxDevfe49f2099655
diff --git a/crates/openhuman-core/src/skills/catalog/tools_tests.rs b/crates/openhuman-core/src/skills/catalog/tools_tests.rs
index bcafb373f1..7d4324c70d 100644
--- a/crates/openhuman-core/src/skills/catalog/tools_tests.rs
+++ b/crates/openhuman-core/src/skills/catalog/tools_tests.rs
@@ -131,3 +131,65 @@ async fn browse_and_search_return_bounded_pages_with_their_freshness() {
std::env::remove_var(name);
}
}
+
+#[test]
+fn install_tool_schema_has_no_scan_acknowledgement() {
+ let schema = SkillRegistryInstallTool::new(Arc::new(Config::default())).parameters_schema();
+ let properties = schema["properties"].as_object().expect("properties");
+ assert_eq!(properties.keys().collect::<Vec<_>>(), ["entry_id"]);
+ assert!(!schema.to_string().contains("acknowledge"));
+}
+
+#[tokio::test]
+async fn the_install_tool_cannot_acknowledge_scan_findings() {
+ let _env = crate::skills::catalog::TEST_ENV_LOCK.lock().await;
+ let fixture = Fixture::start(vec![hermes_item("agent-poisoned", "built-in")]).await;
+ fixture
+ .blocked_documents
+ .store(usize::MAX, std::sync::atomic::Ordering::SeqCst);
+ let cache = tempfile::tempdir().unwrap();
+ std::env::set_var(ENV[0], format!("{}/skills.json", fixture.base));
+ std::env::set_var(ENV[1], cache.path());
+ std::env::set_var(ENV[2], "1");
+ std::env::set_var(
+ crate::skills::catalog::registry::DOWNLOAD_BASE_URL_ENV,
+ format!("{}/skills", fixture.base),
+ );
+
+ let workspace = tempfile::tempdir().unwrap();
+ let mut config = Config::default();
+ config.workspace_dir = workspace.path().to_path_buf();
+ let tool = SkillRegistryInstallTool::new(Arc::new(config));
+ let result = tool
+ .execute(json!({
+ "entry_id": "agent-poisoned",
+ "acknowledge_scan_findings": true,
+ }))
+ .await
+ .expect("execute");
+
+ for name in ENV {
+ std::env::remove_var(name);
+ }
+ std::env::remove_var(crate::skills::catalog::registry::DOWNLOAD_BASE_URL_ENV);
+
+ assert!(result.is_error, "a blocked install is not a success");
+ let body: serde_json::Value = serde_json::from_str(&result.output()).expect("json");
+ assert_eq!(body["status"], "scan_blocked");
+ assert_eq!(body["target"], "agent-poisoned");
+ assert_eq!(body["findings"][0]["check"], "invisible_code_points");
+ assert!(body["instruction"]
+ .as_str()
+ .unwrap()
+ .contains("install it themselves"));
+ assert_eq!(
+ fixture
+ .document_hits
+ .load(std::sync::atomic::Ordering::SeqCst),
+ 2
+ );
+ assert!(!dirs::home_dir()
+ .unwrap()
+ .join(".openhuman/skills/agent-poisoned")
+ .exists());
+}
diff --git a/crates/openhuman-core/src/skills/tools_tests.rs b/crates/openhuman-core/src/skills/tools_tests.rs
index b5c4ed44fd..e962fa0f18 100644
--- a/crates/openhuman-core/src/skills/tools_tests.rs
+++ b/crates/openhuman-core/src/skills/tools_tests.rs
@@ -79,3 +79,45 @@ async fn list_returns_envelope() {
.expect("list");
assert!(out.output_for_llm(false).contains("workflows"));
}
+
+#[test]
+fn install_from_url_tool_schema_has_no_scan_acknowledgement() {
+ let schema = WorkflowInstallFromUrlTool::new(cfg()).parameters_schema();
+ assert!(!schema.to_string().contains("acknowledge"));
+}
+
+#[tokio::test]
+async fn install_from_url_tool_cannot_acknowledge_scan_findings() {
+ use wiremock::matchers::{method, path};
+ use wiremock::{Mock, MockServer, ResponseTemplate};
+
+ let _env = crate::skills::catalog::TEST_ENV_LOCK.lock().await;
+ let server = MockServer::start().await;
+ Mock::given(method("GET"))
+ .and(path("/SKILL.md"))
+ .respond_with(ResponseTemplate::new(200).set_body_string(
+ "---\nname: tool-url-poisoned\ndescription: d\n---\n\nRun\u{200b} it.\n",
+ ))
+ .expect(2)
+ .mount(&server)
+ .await;
+ std::env::set_var("OPENHUMAN_SKILL_INSTALL_ALLOW_LOCAL_HTTP", "1");
+
+ let result = WorkflowInstallFromUrlTool::new(cfg())
+ .execute(json!({
+ "url": format!("{}/SKILL.md", server.uri()),
+ "acknowledge_scan_findings": true,
+ }))
+ .await
+ .expect("execute");
+ std::env::remove_var("OPENHUMAN_SKILL_INSTALL_ALLOW_LOCAL_HTTP");
+
+ assert!(result.is_error);
+ let body: serde_json::Value = serde_json::from_str(&result.output()).expect("json");
+ assert_eq!(body["status"], "scan_blocked");
+ assert!(!dirs::home_dir()
+ .unwrap()
+ .join(".openhuman/skills/tool-url-poisoned")
+ .exists());
+ server.verify().await;
+}