ClawHub Skill Security Scanner — Complete

  85/85 tests passing across 7 test files.

  Files created (all under skills/):

  ┌────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
  │            File            │                                                                           Purpose                                                                            │
  ├────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ models.py                  │ 13 Pydantic v2 models — SkillPackage, ScanResult, Finding, SignedSkill, InstalledSkill, enums, API models                                                    │
  ├────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ scanner/patterns.py        │ 35 detection patterns across 6 categories + 5 ClawHavoc IOCs, configurable PatternDatabase with custom pattern support                                       │
  ├────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ scanner/static_analyzer.py │ StaticAnalyzer.scan() — scans files + metadata, computes 0-10 risk score with severity weighting                                                             │
  ├────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ sandbox/executor.py        │ SkillExecutor.execute() — AST-based behavioural analysis detecting network calls, file access, process spawning, and comparing against declared capabilities │
  ├────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ signing/verifier.py        │ SkillSigner — Ed25519 sign/verify following audit/signing/signer.py pattern, with key persistence                                                            │
  ├────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ registry/store.py          │ SkillRegistry — in-memory CRUD with JSON persistence, status management (ACTIVE/DISABLED/QUARANTINED)                                                        │
  ├────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ installer/pipeline.py      │ SkillInstallPipeline — 9-step orchestrator: receive → scan → risk score → auto-reject CRITICAL → manual approval HIGH → sandbox → sign → install → audit     │
  ├────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
  │ routes.py                  │ 6 FastAPI endpoints: install, list, get, delete, rescan, quarantine                                                                                          │
  └────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

  Detection categories:

  - Prompt injection (8 patterns) — instruction overrides, role hijack, hidden comments, invisible Unicode
  - Malicious code (8 patterns) — os.system, subprocess, eval/exec, ctypes
  - Data exfiltration (6 patterns) — HTTP requests, sockets, base64, webhooks
  - Credential theft (7 patterns) — SSH keys, browser stores, crypto wallets (AMOS), env vars, cloud creds
  - Persistent backdoor (5 patterns) — HEARTBEAT.md, crontab, startup files, reverse shells
  - Dependency risk (4 patterns) — typosquatting, non-PyPI sources, malicious setup.py
  - ClawHavoc IOCs (5 patterns) — osascript, browser harvest paths, ZIP+exfil, curl|sh, LaunchAgent