{"record":{"id":"58e1c7ae3a6e4774","repo":"Hmbown/CodeWhale","slug":"refusing-to-trust-skill-outside-codewhale-owned-ro","errorCode":null,"errorMessage":"refusing to trust skill outside CodeWhale-owned roots","messagePattern":"refusing to trust skill outside CodeWhale-owned roots","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/skills/mutation.rs","lineNumber":975,"sourceCode":"    Ok(SkillMutationReceipt {\n        action: SkillActionKind::Remove,\n        name: skill_id.canonical_name,\n        scope,\n        safe_target_path: safe_display_path(&path, Some(ctx.workspace), ctx.home),\n        before_digest: before,\n        after_digest: None,\n        outcome: SkillMutationOutcome::Removed,\n    })\n}\n\nfn trust_skill(\n    skill_id: AuditedSkillId,\n    expected_digest: String,\n    ctx: &MutationContext<'_>,\n) -> Result<SkillMutationReceipt> {\n    let (skill, path) = find_audited_skill(ctx, &skill_id)?;\n    if !skill.root.is_writable_owned() {\n        bail!(\"refusing to trust skill outside CodeWhale-owned roots\");\n    }\n    if skill.source_kind != SkillSourceKind::CodeWhaleManaged {\n        bail!(\"only CodeWhale managed skills can be trusted\");\n    }\n    validate_owned_skill_path(ctx, &skill, &path)?;\n    let before = verify_expected_digest(&path, Some(&expected_digest))?;\n    validate_owned_skill_path(ctx, &skill, &path)?;\n    write_trust_v2(&path, &expected_digest)?;\n    let scope = match skill.root.kind {\n        SkillRootKind::CodeWhaleProject => SkillScope::Project,\n        SkillRootKind::CodeWhaleGlobal => SkillScope::Global,\n        _ => SkillScope::Logical,\n    };\n    Ok(SkillMutationReceipt {\n        action: SkillActionKind::Trust,\n        name: skill_id.canonical_name,\n        scope,\n        safe_target_path: safe_display_path(&path, Some(ctx.workspace), ctx.home),","sourceCodeStart":957,"sourceCodeEnd":993,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/skills/mutation.rs#L957-L993","documentation":"Raised in trust_skill when the audited skill's root is not a writable CodeWhale-owned root. Trusting a skill writes a digest binding into the tool's owned state, which is only meaningful and safe for packages under its own roots; external locations cannot be trusted through this path.","triggerScenarios":"Thrown at crates/tui/src/skills/mutation.rs:975 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Import the skill into an owned scope and trust the imported copy","Trust bindings are only recorded for CodeWhale-owned roots; manage trust for external skills at their source","Check that the skill id resolves to the owned package when duplicates exist"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}