security(skills): warn when safety metadata is unavailable
Add MetadataAvailable flag to InstallResult. When the registry metadata fetch fails (silent fallback), the user now sees a warning that safety checks could not be completed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
147e26ac60
commit
503bc3f1d2
3 changed files with 11 additions and 6 deletions
|
|
@ -248,6 +248,7 @@ func (c *ClawHubRegistry) DownloadAndInstall(
|
||||||
result.IsMalwareBlocked = meta.IsMalwareBlocked
|
result.IsMalwareBlocked = meta.IsMalwareBlocked
|
||||||
result.IsSuspicious = meta.IsSuspicious
|
result.IsSuspicious = meta.IsSuspicious
|
||||||
result.Summary = meta.Summary
|
result.Summary = meta.Summary
|
||||||
|
result.MetadataAvailable = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 2: Resolve version.
|
// Step 2: Resolve version.
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ type InstallResult struct {
|
||||||
IsMalwareBlocked bool
|
IsMalwareBlocked bool
|
||||||
IsSuspicious bool
|
IsSuspicious bool
|
||||||
Summary string
|
Summary string
|
||||||
|
MetadataAvailable bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// SkillRegistry is the interface that all skill registries must implement.
|
// SkillRegistry is the interface that all skill registries must implement.
|
||||||
|
|
|
||||||
|
|
@ -159,10 +159,13 @@ func (t *InstallSkillTool) Execute(ctx context.Context, args map[string]any) *To
|
||||||
_ = err
|
_ = err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build result with moderation warning if suspicious.
|
// Build result with moderation warnings.
|
||||||
var output string
|
var output string
|
||||||
|
if !result.MetadataAvailable {
|
||||||
|
output += fmt.Sprintf("Warning: safety metadata was not available for skill %q. Exercise caution.\n\n", slug)
|
||||||
|
}
|
||||||
if result.IsSuspicious {
|
if result.IsSuspicious {
|
||||||
output = fmt.Sprintf("⚠️ Warning: skill %q is flagged as suspicious (may contain risky patterns).\n\n", slug)
|
output += fmt.Sprintf("⚠️ Warning: skill %q is flagged as suspicious (may contain risky patterns).\n\n", slug)
|
||||||
}
|
}
|
||||||
output += fmt.Sprintf("Successfully installed skill %q v%s from %s registry.\nLocation: %s\n",
|
output += fmt.Sprintf("Successfully installed skill %q v%s from %s registry.\nLocation: %s\n",
|
||||||
slug, result.Version, registry.Name(), targetDir)
|
slug, result.Version, registry.Name(), targetDir)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue