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
feat(skills): refuse scan-blocked installs unless the user acknowledges them (#7082)
oxoxDev2f65afaa45d6
diff --git a/crates/openhuman-core/src/skills/catalog/ops.rs b/crates/openhuman-core/src/skills/catalog/ops.rsindex 21fb758fab..ce5047ec24 100644--- a/crates/openhuman-core/src/skills/catalog/ops.rs+++ b/crates/openhuman-core/src/skills/catalog/ops.rs@@ -18,7 +18,9 @@ use super::types::{CatalogDetail, CatalogEntry, CatalogPage, CatalogQuery, RegistryCatalogEntry, RegistryFacets,DEFAULT_PAGE_SIZE, MAX_PAGE_SIZE,};-use crate::skills::ops_install::InstallWorkflowFromUrlOutcome;+use crate::skills::ops_install::{+ fetch_scanned, gate_install, ScanAcknowledgement, SkillInstallOutcome,+};const REFRESH_ON_BOOT_ENV: &str = "OPENHUMAN_SKILL_REGISTRY_REFRESH_ON_BOOT";/// Prefix of every registry error a caller sees, followed by the@@ -345,15 +347,22 @@ impl std::fmt::Display for CatalogInstallError {}/// Install a catalog entry, by id or unique name, into the user skills root.+///+/// The document goes through the supply-chain scan gate: a blocking scan or+/// a failed fetch is retried once, and a document that still blocks comes+/// back as [`SkillInstallOutcome::ScanBlocked`] unless `acknowledgement` is+/// [`ScanAcknowledgement::ByUser`].pub async fn install_from_catalog(workspace_dir: &Path,entry_id: &str,-) -> Result<InstallWorkflowFromUrlOutcome, CatalogInstallError> {+ acknowledgement: ScanAcknowledgement,+) -> Result<SkillInstallOutcome, CatalogInstallError> {install_from_catalog_in(&skill_registry(),workspace_dir,dirs::home_dir().as_deref(),entry_id,+ acknowledgement,).await}@@ -363,30 +372,30 @@ pub(crate) async fn install_from_catalog_in(workspace_dir: &Path,home: Option<&Path>,entry_id: &str,-) -> Result<InstallWorkflowFromUrlOutcome, CatalogInstallError> {- tracing::info!(entry_id = %entry_id, "[skill_registry] installing from catalog");- let document = registry- .fetch_document(&EntryKey::new(entry_id))+ acknowledgement: ScanAcknowledgement,+) -> Result<SkillInstallOutcome, CatalogInstallError> {+ tracing::info!(+ entry_id = %entry_id,+ acknowledged = acknowledgement == ScanAcknowledgement::ByUser,+ "[skill_registry] installing from catalog"+ );+ let key = EntryKey::new(entry_id);+ let document = fetch_scanned(entry_id, acknowledgement, || registry.fetch_document(&key)).await.map_err(|error| {observe("install", &error, false);crate::skills::ops_install::report_install_fetch_failure(&error, None);CatalogInstallError::Registry(error)})?;- if document.is_blocked() {- tracing::warn!(- entry_id = %entry_id,- fetched_from = %document.fetched_from,- "[skill_registry] supply-chain scan flagged the document"- );- }- crate::skills::ops_install::install_validated_document(- workspace_dir,- home,- &document.fetched_from,- &document.fetched_from,- document.document,- )+ gate_install(entry_id, acknowledgement, document, |document| {+ crate::skills::ops_install::install_validated_document(+ workspace_dir,+ home,+ &document.fetched_from,+ &document.fetched_from,+ document.document,+ )+ }).map_err(CatalogInstallError::Install)}diff --git a/crates/openhuman-core/src/skills/catalog/ops_install_tests.rs b/crates/openhuman-core/src/skills/catalog/ops_install_tests.rsindex bc2c537390..2c3ba5248f 100644--- a/crates/openhuman-core/src/skills/catalog/ops_install_tests.rs+++ b/crates/openhuman-core/src/skills/catalog/ops_install_tests.rs@@ -27,9 +27,12 @@ async fn installs_a_catalog_entry_once_and_announces_it() {workspace.path(),Some(home.path()),"zz-registry-install",+ ScanAcknowledgement::Absent,).await- .expect("install");+ .expect("install")+ .installed()+ .expect("a clean document installs");assert_eq!(first.new_skills, ["zz-registry-install"]);assert!(first.stdout.contains("Installed to"), "{}", first.stdout);assert!(home@@ -55,9 +58,12 @@ async fn installs_a_catalog_entry_once_and_announces_it() {workspace.path(),Some(home.path()),"zz-registry-install",+ ScanAcknowledgement::Absent,).await- .expect("a repeat install succeeds");+ .expect("a repeat install succeeds")+ .installed()+ .expect("a clean document installs");assert!(second.new_skills.is_empty());assert!(second.stdout.contains("already installed"),@@ -83,6 +89,7 @@ async fn a_portal_entry_fails_fast_with_its_source_page() {home.path(),Some(home.path()),"lobehub/code-audit",+ ScanAcknowledgement::Absent,).await.expect_err("no SKILL.md to fetch");@@ -107,6 +114,7 @@ async fn an_unknown_id_names_real_ids() {home.path(),Some(home.path()),"git-helpr",+ ScanAcknowledgement::Absent,).await.expect_err("unknown id");@@ -124,6 +132,7 @@ async fn a_throttled_document_host_reports_rate_limiting() {home.path(),Some(home.path()),"slow-skill",+ ScanAcknowledgement::Absent,).await.expect_err("throttled");diff --git a/crates/openhuman-core/src/skills/catalog/schemas/controller_schemas.rs b/crates/openhuman-core/src/skills/catalog/schemas/controller_schemas.rsindex f389158e0b..9292fcdea6 100644--- a/crates/openhuman-core/src/skills/catalog/schemas/controller_schemas.rs+++ b/crates/openhuman-core/src/skills/catalog/schemas/controller_schemas.rs@@ -118,7 +118,7 @@ pub fn skill_registry_schemas(function: &str) -> ControllerSchema {"install" => ControllerSchema {namespace: "skill_registry",function: "install",- description: "Install a skill from the catalog by its entry id. Fetches the SKILL.md and installs to user scope.",+ description: "Install a skill from the catalog by its entry id. Fetches the SKILL.md, runs the supply-chain scan (retrying once when it blocks or the fetch fails) and installs to user scope. A document whose scan still blocks is not installed: the result has status `scan_blocked` and the findings.",inputs: vec![FieldSchema {name: "entry_id",@@ -126,33 +126,14 @@ pub fn skill_registry_schemas(function: &str) -> ControllerSchema {comment: "Catalog entry id of the skill to install.",required: true,},- ],- outputs: vec![- FieldSchema {- name: "url",- ty: TypeSchema::String,- comment: "The URL that was fetched.",- required: true,- },FieldSchema {- name: "stdout",- ty: TypeSchema::String,- comment: "Diagnostic summary.",- required: true,- },- FieldSchema {- name: "stderr",- ty: TypeSchema::String,- comment: "Parse warnings.",- required: true,- },- FieldSchema {- name: "new_skills",- ty: TypeSchema::Array(Box::new(TypeSchema::String)),- comment: "Slugs of skills that appeared post-install.",- required: true,+ name: "acknowledge_scan_findings",+ ty: TypeSchema::Bool,+ comment: "Set by the Skills UI only after the user reviewed the scan findings and chose to install anyway. Agent tools cannot set it.",+ required: false,},],+ outputs: install_outputs("new_skills"),},"uninstall" => ControllerSchema {namespace: "skill_registry",@@ -212,6 +193,72 @@ pub fn skill_registry_schemas(function: &str) -> ControllerSchema {}}+/// The outputs of an install that may stop at the supply-chain scan.+pub(crate) fn install_outputs(new_field: &'static str) -> Vec<FieldSchema> {+ vec![+ FieldSchema {+ name: "status",+ ty: TypeSchema::String,+ comment: "`installed`, or `scan_blocked` when the scan still blocks after a retry and nothing was installed.",+ required: true,+ },+ FieldSchema {+ name: "url",+ ty: TypeSchema::String,+ comment: "The URL that was fetched (installed).",+ required: false,+ },+ FieldSchema {+ name: "stdout",+ ty: TypeSchema::String,+ comment: "Diagnostic summary (installed).",+ required: false,+ },+ FieldSchema {+ name: "stderr",+ ty: TypeSchema::String,+ comment: "Parse warnings (installed).",+ required: false,+ },+ FieldSchema {+ name: new_field,+ ty: TypeSchema::Array(Box::new(TypeSchema::String)),+ comment: "Slugs of skills that appeared post-install (installed).",+ required: false,+ },+ FieldSchema {+ name: "target",+ ty: TypeSchema::String,+ comment: "The entry id or URL that was refused (scan_blocked).",+ required: false,+ },+ FieldSchema {+ name: "fetched_from",+ ty: TypeSchema::String,+ comment: "The redacted URL the blocked document came from (scan_blocked).",+ required: false,+ },+ FieldSchema {+ name: "slug",+ ty: TypeSchema::String,+ comment: "The install slug the blocked document would have used (scan_blocked).",+ required: false,+ },+ FieldSchema {+ name: "findings",+ ty: TypeSchema::Array(Box::new(TypeSchema::Json)),+ comment: "Scan findings: `check`, `verdict`, `field` and `message` (scan_blocked).",+ required: false,+ },+ FieldSchema {+ name: "message",+ ty: TypeSchema::String,+ comment: "Why the install was refused (scan_blocked).",+ required: false,+ },+ ]+}+fn catalog_inputs(with_query: bool) -> Vec<FieldSchema> {let mut inputs = Vec::new();if with_query {diff --git a/crates/openhuman-core/src/skills/catalog/schemas/handlers.rs b/crates/openhuman-core/src/skills/catalog/schemas/handlers.rsindex 06756f67f6..b58acb3bcd 100644--- a/crates/openhuman-core/src/skills/catalog/schemas/handlers.rs+++ b/crates/openhuman-core/src/skills/catalog/schemas/handlers.rs@@ -5,11 +5,12 @@ use serde_json::{Map, Value};use crate::core::all::ControllerFuture;use crate::core::Outcome;use crate::skills::catalog::ops;+use crate::skills::ops_install::ScanAcknowledgement;use super::controller_schemas::all_skill_registry_controller_schemas;use super::wire_types::{- CatalogParams, CatalogResult, CategoriesResult, EntryParams, InstallResult, SchemasResult,- SourcesResult, UninstallParams, UninstallResult,+ CatalogParams, CatalogResult, CategoriesResult, EntryParams, InstallParams, InstallResult,+ SchemasResult, SourcesResult, UninstallParams, UninstallResult,};fn deserialize_params<T: serde::de::DeserializeOwned>(@@ -100,26 +101,28 @@ pub(super) fn handle_detail(params: Map<String, Value>) -> ControllerFuture {pub(super) fn handle_install(params: Map<String, Value>) -> ControllerFuture {Box::pin(async move {- let p = deserialize_params::<EntryParams>(params)?;+ let p = deserialize_params::<InstallParams>(params)?;tracing::info!(entry_id = %p.entry_id,+ acknowledge_scan_findings = p.acknowledge_scan_findings,"[skill_registry][rpc] install");let workspace = crate::skills::schemas::resolve_workspace_dir().await;- let outcome = ops::install_from_catalog(&workspace, &p.entry_id)- .await- .map_err(|error| error.to_string())?;+ let outcome: InstallResult = ops::install_from_catalog(+ &workspace,+ &p.entry_id,+ ScanAcknowledgement::from_user_flag(p.acknowledge_scan_findings),+ )+ .await+ .map_err(|error| error.to_string())?;+ tracing::info!(+ entry_id = %p.entry_id,+ status = outcome.status(),+ "[skill_registry][rpc] install result"+ );- to_json(Outcome::new(- InstallResult {- url: outcome.url,- stdout: outcome.stdout,- stderr: outcome.stderr,- new_skills: outcome.new_skills,- },- Vec::new(),- ))+ to_json(Outcome::new(outcome, Vec::new()))})}diff --git a/crates/openhuman-core/src/skills/catalog/schemas/wire_types.rs b/crates/openhuman-core/src/skills/catalog/schemas/wire_types.rsindex fed682ede0..6cf851bd15 100644--- a/crates/openhuman-core/src/skills/catalog/schemas/wire_types.rs+++ b/crates/openhuman-core/src/skills/catalog/schemas/wire_types.rs@@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize};use crate::core::ControllerSchema;use crate::skills::catalog::types::{CatalogPage, CatalogQuery, Facet, Freshness};+use crate::skills::ops_install::SkillInstallOutcome;use crate::skills::ops_types::WorkflowScope;// ── Params ──────────────────────────────────────────────────────────────────@@ -58,6 +59,16 @@ pub(super) struct EntryParams {pub(super) entry_id: String,}+/// `skill_registry_install` params. `acknowledge_scan_findings` is set only+/// by the Skills UI after the user chose to install a skill whose scan+/// blocked; agent tools have no way to pass it.+#[derive(Debug, Deserialize)]+pub(super) struct InstallParams {+ pub(super) entry_id: String,+ #[serde(default)]+ pub(super) acknowledge_scan_findings: bool,+}+#[derive(Debug, Deserialize)]pub(super) struct UninstallParams {pub(super) name: String,@@ -81,13 +92,9 @@ pub(super) struct CategoriesResult {pub(super) freshness: Freshness,}-#[derive(Debug, Serialize)]-pub(super) struct InstallResult {- pub(super) url: String,- pub(super) stdout: String,- pub(super) stderr: String,- pub(super) new_skills: Vec<String>,-}+/// `status: "installed"` with the install fields, or `status: "scan_blocked"`+/// with the scan findings.+pub(super) type InstallResult = SkillInstallOutcome;#[derive(Debug, Serialize)]pub(super) struct UninstallResult {diff --git a/crates/openhuman-core/src/skills/catalog/tools.rs b/crates/openhuman-core/src/skills/catalog/tools.rsindex 37ccc6d687..469be55285 100644--- a/crates/openhuman-core/src/skills/catalog/tools.rs+++ b/crates/openhuman-core/src/skills/catalog/tools.rs@@ -10,6 +10,7 @@ use async_trait::async_trait;use serde_json::json;use crate::config::Config;+use crate::skills::ops_install::{ScanAcknowledgement, ScanBlockedOutcome, SkillInstallOutcome};use crate::tools::status::{NOT_FOUND_MARKER, UNSUPPORTED_MARKER};use tinytools::{PermissionLevel, Tool, ToolResult};@@ -122,6 +123,27 @@ fn with_paging(mut properties: serde_json::Value) -> serde_json::Value {properties}+/// What the agent is told after the supply-chain scan refused an install.+pub(crate) const SCAN_BLOCKED_AGENT_INSTRUCTION: &str = "The security scan blocked this skill \+ and it was NOT installed. Do not retry the install. Tell the user what the scan found and \+ that, if they still want the skill, they can review the findings and install it themselves \+ from the Skills page.";++pub(crate) fn scan_blocked_tool_result(blocked: &ScanBlockedOutcome) -> anyhow::Result<ToolResult> {+ tracing::info!(+ target_id = %blocked.target,+ findings = blocked.findings.len(),+ "[tool][skill_registry] install refused by the scan"+ );+ Ok(ToolResult::error(serde_json::to_string(&json!({+ "status": "scan_blocked",+ "target": blocked.target,+ "findings": blocked.findings,+ "message": blocked.message,+ "instruction": SCAN_BLOCKED_AGENT_INSTRUCTION,+ }))?))+}+fn registry_tool_error(action: &str, error: &tinyskills::RegistryError) -> ToolResult {let marker = match error.kind() {RegistryErrorKind::NotFound | RegistryErrorKind::UnknownRegistry => {@@ -256,8 +278,10 @@ impl Tool for SkillRegistryInstallTool {fn description(&self) -> &str {"Install a skill from the catalog by its entry_id. Downloads the \- SKILL.md and installs it locally. Use `skill_registry_search` first \- to find the entry to install."+ SKILL.md, runs the security scan and installs it locally. Use \+ `skill_registry_search` first to find the entry to install. A \+ `scan_blocked` result means nothing was installed: tell the user, \+ who can choose to install it from the Skills page."}fn parameters_schema(&self) -> serde_json::Value {@@ -294,13 +318,19 @@ impl Tool for SkillRegistryInstallTool {tracing::debug!(entry_id = %entry_id, "[tool][skill_registry] install");- match ops::install_from_catalog(&self.workspace_dir, entry_id).await {- Ok(outcome) => Ok(ToolResult::success(serde_json::to_string(&json!({- "url": outcome.url,- "stdout": outcome.stdout,- "stderr": outcome.stderr,- "new_skills": outcome.new_skills,- }))?)),+ match ops::install_from_catalog(&self.workspace_dir, entry_id, ScanAcknowledgement::Absent)+ .await+ {+ Ok(SkillInstallOutcome::Installed(outcome)) => {+ Ok(ToolResult::success(serde_json::to_string(&json!({+ "status": "installed",+ "url": outcome.url,+ "stdout": outcome.stdout,+ "stderr": outcome.stderr,+ "new_skills": outcome.new_skills,+ }))?))+ }+ Ok(SkillInstallOutcome::ScanBlocked(blocked)) => scan_blocked_tool_result(&blocked),Err(ops::CatalogInstallError::Registry(error)) => Ok(registry_tool_error(&format!("install skill '{entry_id}'"),&error,diff --git a/crates/openhuman-core/src/skills/ops_create_and_url_tests.rs b/crates/openhuman-core/src/skills/ops_create_and_url_tests.rsindex 63d10fcb89..09910d013a 100644--- a/crates/openhuman-core/src/skills/ops_create_and_url_tests.rs+++ b/crates/openhuman-core/src/skills/ops_create_and_url_tests.rs@@ -344,15 +344,25 @@ async fn install_workflow_from_url_is_idempotent_when_skill_already_exists() {params.clone(),Some(home.path()),true,+ crate::skills::ops_install::ScanAcknowledgement::Absent,).await- .unwrap();+ .unwrap()+ .installed()+ .expect("a clean document installs");assert_eq!(first.new_skills, vec!["apple-notes"]);- let second =- install_workflow_from_url_with_home(workspace.path(), params, Some(home.path()), true)- .await- .unwrap();+ let second = install_workflow_from_url_with_home(+ workspace.path(),+ params,+ Some(home.path()),+ true,+ crate::skills::ops_install::ScanAcknowledgement::Absent,+ )+ .await+ .unwrap()+ .installed()+ .expect("a repeat install succeeds");assert!(second.new_skills.is_empty(), "{second:?}");assert!(second.stdout.contains("already installed"), "{second:?}");}diff --git a/crates/openhuman-core/src/skills/ops_install/fetch.rs b/crates/openhuman-core/src/skills/ops_install/fetch.rsindex 5935158b9c..799c48a38a 100644--- a/crates/openhuman-core/src/skills/ops_install/fetch.rs+++ b/crates/openhuman-core/src/skills/ops_install/fetch.rs@@ -9,11 +9,11 @@ use serde::{Deserialize, Serialize};use tinyskills::{fetch_skill_document, redact_url, write_installed_document, DocumentWrite, FetchPolicy,- FetchedDocument, RegistryError, RegistryLimits, RegistryTimeouts, SystemResolver,- MAX_INSTALL_DOCUMENT_BYTES,+ FetchedDocument, RegistryError, RegistryLimits, SystemResolver, MAX_INSTALL_DOCUMENT_BYTES,};use super::super::ops_discover::{discover_workflows_inner, is_workspace_trusted};+use super::scan_gate::{fetch_scanned, gate_install, ScanAcknowledgement, SkillInstallOutcome};use super::url_validation::read_allow_local_http_env;use super::url_validation::{normalize_install_url, validate_install_url_with_config};use crate::skills::catalog::ReqwestTransport;@@ -108,14 +108,26 @@ pub struct InstallWorkflowFromUrlOutcome {/// On success the full post-install skills catalog is re-discovered and the/// outcome includes the list of skill slugs that appeared since the start of/// the call.+///+/// The fetched document goes through the supply-chain scan gate: a blocking+/// scan or a failed fetch is retried once, and a document that still blocks+/// is returned as [`SkillInstallOutcome::ScanBlocked`] unless `acknowledgement`+/// is [`ScanAcknowledgement::ByUser`].pub async fn install_workflow_from_url(workspace_dir: &Path,params: InstallWorkflowFromUrlParams,-) -> Result<InstallWorkflowFromUrlOutcome, String> {+ acknowledgement: ScanAcknowledgement,+) -> Result<SkillInstallOutcome, String> {let home = dirs::home_dir();let allow_local_http = read_allow_local_http_env();- install_workflow_from_url_with_home(workspace_dir, params, home.as_deref(), allow_local_http)- .await+ install_workflow_from_url_with_home(+ workspace_dir,+ params,+ home.as_deref(),+ allow_local_http,+ acknowledgement,+ )+ .await}/// Whether a non-`2xx` status is worth reporting: a `4xx` means the URL is@@ -189,7 +201,8 @@ pub(crate) async fn install_workflow_from_url_with_home(params: InstallWorkflowFromUrlParams,home: Option<&Path>,allow_local_http: bool,-) -> Result<InstallWorkflowFromUrlOutcome, String> {+ acknowledgement: ScanAcknowledgement,+) -> Result<SkillInstallOutcome, String> {let raw_url = params.url.trim().to_string();validate_install_url_with_config(&raw_url, allow_local_http)?;@@ -211,29 +224,28 @@ pub(crate) async fn install_workflow_from_url_with_home(let mut policy = FetchPolicy::default();policy.allow_loopback_http = allow_local_http;policy.user_agent = format!("openhuman-core/{}", env!("CARGO_PKG_VERSION"));- let mut timeouts = RegistryTimeouts::default();+ let mut timeouts = crate::skills::catalog::registry_timeouts();timeouts.document = Duration::from_secs(timeout_secs);let mut limits = RegistryLimits::default();limits.max_document_bytes = MAX_WORKFLOW_MD_BYTES as u64;- let fetched = fetch_skill_document(- Arc::new(ReqwestTransport::new()),- Arc::new(SystemResolver),- &fetch_url,- &policy,- &timeouts,- &limits,- )+ let transport: Arc<ReqwestTransport> = Arc::new(ReqwestTransport::new());+ let fetched = fetch_scanned(&raw_url, acknowledgement, || {+ fetch_skill_document(+ transport.clone(),+ Arc::new(SystemResolver),+ &fetch_url,+ &policy,+ &timeouts,+ &limits,+ )+ }).await.map_err(|error| install_fetch_error(&error, &fetch_url, timeout_secs))?;- if fetched.is_blocked() {- tracing::warn!(- fetch_url = %redact_url(&fetch_url),- "[skills] install_workflow_from_url: supply-chain scan flagged the document"- );- }- install_validated_document(workspace_dir, home, &raw_url, &fetch_url, fetched.document)+ gate_install(&raw_url, acknowledgement, fetched, |document| {+ install_validated_document(workspace_dir, home, &raw_url, &fetch_url, document.document)+ })}/// Write a validated `SKILL.md` into the user skills root, re-discover, anddiff --git a/crates/openhuman-core/src/skills/ops_install_failure_tests.rs b/crates/openhuman-core/src/skills/ops_install_failure_tests.rsindex ea08818bc1..0115e55580 100644--- a/crates/openhuman-core/src/skills/ops_install_failure_tests.rs+++ b/crates/openhuman-core/src/skills/ops_install_failure_tests.rs@@ -39,6 +39,7 @@ async fn a_throttled_host_reports_rate_limiting_with_its_retry_after() {},Some(home.path()),true,+ crate::skills::ops_install::ScanAcknowledgement::Absent,).await.expect_err("a 429 must fail the install");@@ -77,6 +78,7 @@ async fn a_throttled_host_without_retry_after_still_reports_rate_limiting() {},Some(home.path()),true,+ crate::skills::ops_install::ScanAcknowledgement::Absent,).await.expect_err("a 429 must fail the install");@@ -112,6 +114,7 @@ async fn a_missing_skill_is_not_reported_as_rate_limiting() {},Some(home.path()),true,+ crate::skills::ops_install::ScanAcknowledgement::Absent,).await.expect_err("a 404 must fail the install");@@ -180,6 +183,7 @@ async fn a_slow_host_reports_the_clamped_timeout() {},Some(home.path()),true,+ crate::skills::ops_install::ScanAcknowledgement::Absent,).await.expect_err("the host outlasts the budget");@@ -207,6 +211,7 @@ async fn a_document_without_frontmatter_is_refused() {},Some(home.path()),true,+ crate::skills::ops_install::ScanAcknowledgement::Absent,).await.expect_err("not a SKILL.md");diff --git a/crates/openhuman-core/src/skills/ops_install_install_fetch_tests_tests.rs b/crates/openhuman-core/src/skills/ops_install_install_fetch_tests_tests.rsindex 48ed4de787..8a3a04c4f4 100644--- a/crates/openhuman-core/src/skills/ops_install_install_fetch_tests_tests.rs+++ b/crates/openhuman-core/src/skills/ops_install_install_fetch_tests_tests.rs@@ -38,6 +38,7 @@ async fn non_2xx_install_fetch_returns_err_for_4xx_and_5xx() {},None,true,+ crate::skills::ops_install::ScanAcknowledgement::Absent,).await.expect_err("a non-2xx fetch must return Err so the UI surfaces it");diff --git a/crates/openhuman-core/src/skills/schemas/controller_schemas.rs b/crates/openhuman-core/src/skills/schemas/controller_schemas.rsindex ff781ac942..fbadcd987a 100644--- a/crates/openhuman-core/src/skills/schemas/controller_schemas.rs+++ b/crates/openhuman-core/src/skills/schemas/controller_schemas.rs@@ -293,7 +293,7 @@ pub fn skills_schemas(function: &str) -> ControllerSchema {"skills_install_from_url" => ControllerSchema {namespace: "skills",function: "install_from_url",- description: "Install a remote skill by fetching its SKILL.md over HTTPS and writing it into the user-scope skills directory. URL must be https, resolve to a public host, and point at a single `.md` file (`github.com/.../blob/...` auto-rewrites to raw). Default 60s timeout, max 600s.",+ description: "Install a remote skill by fetching its SKILL.md over HTTPS and writing it into the user-scope skills directory. URL must be https, resolve to a public host, and point at a single `.md` file (`github.com/.../blob/...` auto-rewrites to raw). Default 60s timeout, max 600s. The document is scanned (retried once when the scan blocks or the fetch fails); one that still blocks is not installed and the result has status `scan_blocked` with the findings.",inputs: vec![FieldSchema {name: "url",@@ -307,33 +307,16 @@ pub fn skills_schemas(function: &str) -> ControllerSchema {comment: "Optional wall-clock override in seconds. Default 60, capped at 600.",required: false,},- ],- outputs: vec![- FieldSchema {- name: "url",- ty: TypeSchema::String,- comment: "Echo of the installed URL.",- required: true,- },FieldSchema {- name: "stdout",- ty: TypeSchema::String,- comment: "Human-readable diagnostic summary (bytes fetched, target path).",- required: true,- },- FieldSchema {- name: "stderr",- ty: TypeSchema::String,- comment: "Non-fatal frontmatter parse warnings, joined by newlines.",- required: true,- },- FieldSchema {- name: "new_workflows",- ty: TypeSchema::Array(Box::new(TypeSchema::String)),- comment: "Slugs of workflows that appeared in the catalog as a result of the install.",- required: true,+ name: "acknowledge_scan_findings",+ ty: TypeSchema::Bool,+ comment: "Set by the Skills UI only after the user reviewed the scan findings and chose to install anyway. Agent tools cannot set it.",+ required: false,},],+ outputs: crate::skills::catalog::schemas::controller_schemas::install_outputs(+ "new_workflows",+ ),},"skills_read_run_log" => ControllerSchema {namespace: "skills",diff --git a/crates/openhuman-core/src/skills/schemas/handlers.rs b/crates/openhuman-core/src/skills/schemas/handlers.rsindex a7a13ce5e3..f25a975d6e 100644--- a/crates/openhuman-core/src/skills/schemas/handlers.rs+++ b/crates/openhuman-core/src/skills/schemas/handlers.rs@@ -16,6 +16,7 @@ use crate::skills::ops::{is_workspace_trusted, read_workflow_resource, uninstall_workflow, CreateWorkflowParams,UninstallWorkflowParams,};+use crate::skills::ops_install::ScanAcknowledgement;use crate::skills::runtime::spawn_workflow_run_background;use crate::skills::{registry, run_log};@@ -284,25 +285,21 @@ pub(super) fn handle_skills_install_from_url(params: Map<String, Value>) -> Conttracing::debug!(url = %wire.url,timeout_secs = ?wire.timeout_secs,+ acknowledge_scan_findings = wire.acknowledge_scan_findings,"[skills][rpc] install_from_url");let config = resolve_config().await;let workspace = config.workspace_dir.clone();+ let acknowledgement = ScanAcknowledgement::from_user_flag(wire.acknowledge_scan_findings);let payload = wire.into();- match install_workflow_from_url(workspace.as_path(), payload).await {+ match install_workflow_from_url(workspace.as_path(), payload, acknowledgement).await {Ok(outcome) => {tracing::debug!(- url = %outcome.url,- new_count = outcome.new_skills.len(),+ status = outcome.status(),"[skills][rpc] install_from_url: ok");to_json(Outcome::new(- WorkflowsInstallFromUrlResult {- url: outcome.url,- stdout: outcome.stdout,- stderr: outcome.stderr,- new_workflows: outcome.new_skills,- },+ WorkflowsInstallFromUrlResult::from(outcome),Vec::new(),))}diff --git a/crates/openhuman-core/src/skills/schemas/wire_types.rs b/crates/openhuman-core/src/skills/schemas/wire_types.rsindex 7473ce77bd..ed6f8100fe 100644--- a/crates/openhuman-core/src/skills/schemas/wire_types.rs+++ b/crates/openhuman-core/src/skills/schemas/wire_types.rs@@ -10,6 +10,7 @@ use crate::skills::ops::{CreateWorkflowParams, InstallWorkflowFromUrlParams, Workflow, WorkflowCreateInputDef,WorkflowScope,};+use crate::skills::ops_install::{ScanBlockedOutcome, SkillInstallOutcome};// ── Params ────────────────────────────────────────────────────────────────────@@ -82,6 +83,10 @@ pub(super) struct WorkflowsInstallFromUrlParamsWire {pub(super) url: String,#[serde(default)]pub(super) timeout_secs: Option<u64>,+ /// Set only by the Skills UI after the user chose to install a skill+ /// whose scan blocked.+ #[serde(default)]+ pub(super) acknowledge_scan_findings: bool,}impl From<WorkflowsInstallFromUrlParamsWire> for InstallWorkflowFromUrlParams {@@ -210,11 +215,29 @@ pub(super) struct WorkflowsCreateResult {}#[derive(Debug, Serialize)]-pub(super) struct WorkflowsInstallFromUrlResult {- pub(super) url: String,- pub(super) stdout: String,- pub(super) stderr: String,- pub(super) new_workflows: Vec<String>,+#[serde(tag = "status", rename_all = "snake_case")]+pub(super) enum WorkflowsInstallFromUrlResult {+ Installed {+ url: String,+ stdout: String,+ stderr: String,+ new_workflows: Vec<String>,+ },+ ScanBlocked(ScanBlockedOutcome),+}++impl From<SkillInstallOutcome> for WorkflowsInstallFromUrlResult {+ fn from(outcome: SkillInstallOutcome) -> Self {+ match outcome {+ SkillInstallOutcome::Installed(installed) => Self::Installed {+ url: installed.url,+ stdout: installed.stdout,+ stderr: installed.stderr,+ new_workflows: installed.new_skills,+ },+ SkillInstallOutcome::ScanBlocked(blocked) => Self::ScanBlocked(blocked),+ }+ }}#[derive(Debug, Serialize)]diff --git a/crates/openhuman-core/src/skills/tools/write.rs b/crates/openhuman-core/src/skills/tools/write.rsindex c4152ced4b..9e4acf16b9 100644--- a/crates/openhuman-core/src/skills/tools/write.rs+++ b/crates/openhuman-core/src/skills/tools/write.rs@@ -11,7 +11,10 @@ use crate::config::Config;use tinytools::{PermissionLevel, Tool, ToolResult};use super::super::ops_create::{create_workflow, CreateWorkflowParams};-use super::super::ops_install::{install_workflow_from_url, InstallWorkflowFromUrlParams};+use super::super::ops_install::{+ install_workflow_from_url, InstallWorkflowFromUrlParams, ScanAcknowledgement,+ SkillInstallOutcome,+};/// Scaffold a new user skill. **Writes to disk** — default-OFF.pub struct WorkflowCreateTool {@@ -95,8 +98,9 @@ impl Tool for WorkflowInstallFromUrlTool {fn description(&self) -> &str {"Install a user workflow from a remote `url` (https, must point at a \SKILL.md). Fetches and writes it under `~/.openhuman/skills/`. \- Optional `timeout_secs`. Collisions are rejected. Only use when the \- user explicitly asks to install a workflow from a URL."+ Optional `timeout_secs`. Collisions are rejected. A `scan_blocked` \+ result means the security scan refused it and nothing was installed. \+ Only use when the user explicitly asks to install a workflow from a URL."}fn parameters_schema(&self) -> serde_json::Value {@@ -123,9 +127,17 @@ impl Tool for WorkflowInstallFromUrlTool {log::debug!("[tool][skills] install_from_url invoked");let params: InstallWorkflowFromUrlParams = serde_json::from_value(args).map_err(|e| anyhow::anyhow!("install_workflow_from_url: invalid params: {e}"))?;- let outcome = install_workflow_from_url(&self.workspace_dir, params)- .await- .map_err(|e| anyhow::anyhow!("install_workflow_from_url: {e}"))?;- Ok(ToolResult::success(serde_json::to_string(&outcome)?))+ let outcome =+ install_workflow_from_url(&self.workspace_dir, params, ScanAcknowledgement::Absent)+ .await+ .map_err(|e| anyhow::anyhow!("install_workflow_from_url: {e}"))?;+ match outcome {+ SkillInstallOutcome::Installed(installed) => {+ Ok(ToolResult::success(serde_json::to_string(&installed)?))+ }+ SkillInstallOutcome::ScanBlocked(blocked) => {+ crate::skills::catalog::tools::scan_blocked_tool_result(&blocked)+ }+ }}}