@rafter-security/cli 0.6.6 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +29 -10
  2. package/dist/commands/agent/audit-skill.js +22 -20
  3. package/dist/commands/agent/audit.js +27 -0
  4. package/dist/commands/agent/components.js +800 -0
  5. package/dist/commands/agent/config.js +2 -1
  6. package/dist/commands/agent/disable.js +47 -0
  7. package/dist/commands/agent/enable.js +50 -0
  8. package/dist/commands/agent/exec.js +2 -0
  9. package/dist/commands/agent/index.js +6 -0
  10. package/dist/commands/agent/init.js +162 -163
  11. package/dist/commands/agent/install-hook.js +15 -14
  12. package/dist/commands/agent/list.js +72 -0
  13. package/dist/commands/agent/scan.js +4 -3
  14. package/dist/commands/agent/verify.js +1 -1
  15. package/dist/commands/backend/run.js +12 -3
  16. package/dist/commands/backend/scan-status.js +3 -2
  17. package/dist/commands/brief.js +22 -2
  18. package/dist/commands/ci/init.js +25 -21
  19. package/dist/commands/completion.js +4 -3
  20. package/dist/commands/docs/index.js +18 -0
  21. package/dist/commands/docs/list.js +37 -0
  22. package/dist/commands/docs/show.js +64 -0
  23. package/dist/commands/mcp/server.js +84 -0
  24. package/dist/commands/report.js +42 -41
  25. package/dist/commands/scan/index.js +7 -5
  26. package/dist/commands/skill/index.js +14 -0
  27. package/dist/commands/skill/install.js +89 -0
  28. package/dist/commands/skill/list.js +79 -0
  29. package/dist/commands/skill/registry.js +273 -0
  30. package/dist/commands/skill/remote.js +333 -0
  31. package/dist/commands/skill/review.js +975 -0
  32. package/dist/commands/skill/uninstall.js +65 -0
  33. package/dist/core/audit-logger.js +262 -21
  34. package/dist/core/config-manager.js +3 -0
  35. package/dist/core/docs-loader.js +148 -0
  36. package/dist/core/policy-loader.js +72 -1
  37. package/dist/core/risk-rules.js +16 -3
  38. package/dist/index.js +19 -9
  39. package/dist/scanners/gitleaks.js +6 -2
  40. package/package.json +1 -1
  41. package/resources/skills/rafter/SKILL.md +77 -97
  42. package/resources/skills/rafter/docs/backend.md +106 -0
  43. package/resources/skills/rafter/docs/cli-reference.md +199 -0
  44. package/resources/skills/rafter/docs/finding-triage.md +79 -0
  45. package/resources/skills/rafter/docs/guardrails.md +91 -0
  46. package/resources/skills/rafter/docs/shift-left.md +64 -0
  47. package/resources/skills/rafter-agent-security/SKILL.md +1 -1
  48. package/resources/skills/rafter-code-review/SKILL.md +91 -0
  49. package/resources/skills/rafter-code-review/docs/api.md +90 -0
  50. package/resources/skills/rafter-code-review/docs/asvs.md +120 -0
  51. package/resources/skills/rafter-code-review/docs/cwe-top25.md +78 -0
  52. package/resources/skills/rafter-code-review/docs/investigation-playbook.md +101 -0
  53. package/resources/skills/rafter-code-review/docs/llm.md +87 -0
  54. package/resources/skills/rafter-code-review/docs/web-app.md +84 -0
  55. package/resources/skills/rafter-secure-design/SKILL.md +103 -0
  56. package/resources/skills/rafter-secure-design/docs/api-design.md +97 -0
  57. package/resources/skills/rafter-secure-design/docs/auth.md +67 -0
  58. package/resources/skills/rafter-secure-design/docs/data-storage.md +90 -0
  59. package/resources/skills/rafter-secure-design/docs/dependencies.md +101 -0
  60. package/resources/skills/rafter-secure-design/docs/deployment.md +104 -0
  61. package/resources/skills/rafter-secure-design/docs/ingestion.md +98 -0
  62. package/resources/skills/rafter-secure-design/docs/standards-pointers.md +102 -0
  63. package/resources/skills/rafter-secure-design/docs/threat-modeling.md +128 -0
  64. package/resources/skills/rafter-skill-review/SKILL.md +106 -0
  65. package/resources/skills/rafter-skill-review/docs/authorship-provenance.md +82 -0
  66. package/resources/skills/rafter-skill-review/docs/changelog-review.md +99 -0
  67. package/resources/skills/rafter-skill-review/docs/data-practices.md +88 -0
  68. package/resources/skills/rafter-skill-review/docs/malware-indicators.md +79 -0
  69. package/resources/skills/rafter-skill-review/docs/prompt-injection.md +85 -0
  70. package/resources/skills/rafter-skill-review/docs/telemetry.md +78 -0
@@ -0,0 +1,102 @@
1
+ # Standards & Frameworks — Pointers
2
+
3
+ This skill won't re-derive a compliance checklist. Pick the right baseline for your context, read the small number of sections that actually apply, and point your design doc at them. The goal is *known-adequate*, not *comprehensive*.
4
+
5
+ ## How to choose a baseline
6
+
7
+ Answer these three before picking a framework:
8
+
9
+ 1. **Regulatory scope**: GDPR / CCPA (personal data)? HIPAA (health)? PCI-DSS (payment cards)? SOX (financial reporting)? Each forces specific controls; skipping the wrong one is non-negotiable risk.
10
+ 2. **Maturity goal**: "We need something defensible in review" (ASVS L1), "We handle meaningful PII" (ASVS L2 + SAMM intermediate), "We're a high-value target or regulated" (ASVS L3 + NIST SSDF + SOC 2).
11
+ 3. **Audit horizon**: will anyone external look at this? If yes, align with their expected framework early; retrofitting evidence is expensive.
12
+
13
+ ## App security baseline — OWASP ASVS
14
+
15
+ [OWASP Application Security Verification Standard](https://owasp.org/www-project-application-security-verification-standard/).
16
+
17
+ - **L1 — opportunistic**: external-facing apps without sensitive data. Covers basic auth, input validation, encoding, config. This is the floor; below L1 is "indefensible."
18
+ - **L2 — standard**: apps handling PII, business-critical data, or B2B integrations. Adds cryptography requirements, session depth, access-control rigor.
19
+ - **L3 — advanced**: high-value targets, regulated industries, critical infrastructure. Adds deep crypto requirements, defense-in-depth, hostile-environment assumptions.
20
+
21
+ **Design-time use**: pick your level, scan the chapter for your domain (auth → V2, session → V3, access control → V4, validation → V5, crypto → V6, etc.), lift the requirements that match your design. Don't copy all 280+ requirements — that's audit prep, not design.
22
+
23
+ `rafter-code-review/docs/asvs.md` has a deeper walk for review time.
24
+
25
+ ## Secure development lifecycle — NIST SSDF / SP 800-218
26
+
27
+ [NIST Secure Software Development Framework](https://csrc.nist.gov/projects/ssdf).
28
+
29
+ Four practice areas — *PO* (prepare the org), *PS* (protect the software), *PW* (produce well-secured software), *RV* (respond to vulnerabilities). Most relevant at design time:
30
+
31
+ - **PW.1**: design software to meet security requirements and mitigate risks — the "why are we doing this skill" requirement.
32
+ - **PW.4**: reuse existing well-secured software — dependency selection (see `docs/dependencies.md`).
33
+ - **PW.6**: configure compilation/build/runtime for security — deployment posture.
34
+ - **RV.1**: identify vulnerabilities on ongoing basis — SCA + scanning.
35
+
36
+ Use SSDF as the program-level framework; ASVS fills in the per-app details.
37
+
38
+ ## Cloud & infra — CSA CCM / CIS Benchmarks / AWS Well-Architected
39
+
40
+ - **[CSA Cloud Controls Matrix](https://cloudsecurityalliance.org/research/cloud-controls-matrix/)**: cloud-native control framework, maps to ISO 27001 / SOC 2 / NIST / etc. Good for answering "are we doing the cloud thing right?"
41
+ - **[CIS Benchmarks](https://www.cisecurity.org/cis-benchmarks)** per cloud / OS / Kubernetes: concrete configuration checklists. Use for hardening specific components.
42
+ - **[AWS Well-Architected — Security Pillar](https://docs.aws.amazon.com/wellarchitected/latest/security-pillar/welcome.html)** (or GCP/Azure equivalents): opinionated cloud-architecture guidance. Start here before CCM for most AWS-native designs.
43
+
44
+ Pick one per component. Don't adopt all three to "maximize coverage" — they overlap and you'll drown.
45
+
46
+ ## Threat modeling reference
47
+
48
+ - **[Microsoft STRIDE](https://learn.microsoft.com/en-us/security/securing-devops/threat-modeling)** — the classic, used in `docs/threat-modeling.md`.
49
+ - **[MITRE ATT&CK](https://attack.mitre.org/)** — tactics/techniques for *real-world* attacker behavior. Use to sanity-check "what would an attacker actually do?"
50
+ - **[OWASP ASVS-companion ATM process](https://owasp.org/www-project-threat-modeling/)** — OWASP-flavored threat modeling methodology.
51
+ - **[LINDDUN](https://linddun.org/)** — privacy-focused threat modeling (complement to STRIDE for PII-heavy designs).
52
+
53
+ ## Privacy & compliance
54
+
55
+ - **GDPR**: data minimization, purpose limitation, user rights (access, deletion, portability), data transfer restrictions. Design-time decisions: what you collect, why, how long, where it lives.
56
+ - **CCPA / CPRA**: similar shape, California-specific. Know-your-rights, opt-out of sale.
57
+ - **HIPAA** (US health): PHI definition, covered entity / BA relationships. Requires BAAs with sub-processors.
58
+ - **PCI-DSS** (cards): scope reduction is the name of the game — tokenize early, keep cardholder data out of your systems.
59
+ - **SOC 2**: not a regulation, a report. Trust Services Criteria (Security, Availability, Confidentiality, Processing Integrity, Privacy). Design maps to controls; audit reads evidence.
60
+ - **ISO 27001**: information security management system. Certification is program-level, not design-level, but many controls live in design decisions.
61
+
62
+ At design time, the answer is usually "we're in scope for X, Y; Z doesn't apply; here's the mapping." Not a full compliance plan — just a pointer.
63
+
64
+ ## AI / LLM-specific
65
+
66
+ - **[OWASP LLM Top 10](https://owasp.org/www-project-top-10-for-large-language-model-applications/)** (2025): prompt injection, data disclosure, supply chain, poisoning, improper output handling, excessive agency, prompt leakage, vector/embedding weaknesses, misinformation, unbounded consumption.
67
+ - **[MITRE ATLAS](https://atlas.mitre.org/)**: ATT&CK for AI/ML systems.
68
+ - **[NIST AI RMF](https://www.nist.gov/itl/ai-risk-management-framework)**: risk management framework for AI (govern, map, measure, manage).
69
+ - **EU AI Act** (if you ship in EU): risk categories + obligations. High-risk systems have heavy requirements; general-purpose AI has lighter.
70
+
71
+ `rafter-code-review/docs/llm.md` walks LLM top 10 for review time.
72
+
73
+ ## Cheap-and-fast subset to start with
74
+
75
+ If you have 30 minutes and need a defensible baseline for a new feature:
76
+
77
+ 1. Pick ASVS L1 or L2 (L2 if any PII).
78
+ 2. Read the chapter that matches your design's top risk (auth / input / access control / crypto — whichever is most novel).
79
+ 3. Check CIS Benchmark for your cloud + one container-level CIS (if containerized).
80
+ 4. Write the applicable compliance scope (GDPR? HIPAA? none?).
81
+ 5. Document the threat-model pass result (from `docs/threat-modeling.md`).
82
+
83
+ This is less than a full compliance program and more than "we winged it." Most features don't need more at kickoff.
84
+
85
+ ## When to hire the specialist
86
+
87
+ The pointers above get you to "informed designer." They do not replace:
88
+
89
+ - A pentester on a high-risk launch.
90
+ - A compliance counsel for novel regulatory scope (PCI-DSS 4.0, GDPR cross-border, HIPAA BAs).
91
+ - A third-party audit for SOC 2 / ISO 27001 / FedRAMP.
92
+
93
+ Budget for these where the risk warrants. Skipping them is a risk transfer to the future, usually at a higher cost.
94
+
95
+ ---
96
+
97
+ ## Exit criteria
98
+
99
+ - The applicable regulatory scope is named (or "none, B2B internal only, accepted").
100
+ - The baseline framework is picked (ASVS L?, SSDF yes/no).
101
+ - The specific sections of the framework that match this design's novel risks are cited in the design doc.
102
+ - Compliance obligations (if any) are routed to a human owner, not left as "TBD".
@@ -0,0 +1,128 @@
1
+ # Threat Modeling — STRIDE on the Specific Design
2
+
3
+ This is the capstone. Walk after the individual decisions (auth, data, API, ingestion, deployment) are drafted. The goal: stress-test the design by asking "how would an attacker break *this specific thing*?"
4
+
5
+ ## Setup — the diagram you actually need
6
+
7
+ Before STRIDE, draw two things. Prose is fine; ASCII is fine. Drawings get handwaved.
8
+
9
+ 1. **Data-flow diagram**: boxes for processes, cylinders for stores, arrows for flows. Label each arrow with what crosses it (request type, data fields).
10
+ 2. **Trust boundaries**: dotted lines *across* the arrows — every arrow that crosses a boundary is a security control point.
11
+
12
+ Minimum sketch:
13
+ ```
14
+ [Browser] → [CDN/WAF] ┆→ [API Gateway] → [App Service] ┆→ [DB]
15
+
16
+ [Third-Party API]
17
+ ```
18
+ Boundaries: browser↔edge, edge↔app, app↔DB, app↔third-party.
19
+
20
+ Each boundary is where STRIDE is most productive.
21
+
22
+ ## STRIDE — one per category, per boundary
23
+
24
+ The trick is not to apply STRIDE globally; apply it to each trust-boundary crossing and each data-store.
25
+
26
+ ### S — Spoofing (identity)
27
+
28
+ Applied per boundary: can the entity on the other side be impersonated?
29
+
30
+ - Browser → edge: can an attacker present a valid-looking session cookie / token they didn't earn? (Authn strength, token theft, XSS → cookie steal.)
31
+ - App → DB: is the DB credential stealable? Replayable? Scoped to the app's workload identity, or shared?
32
+ - App → third-party: does the third-party authenticate the calling app? (Mutual TLS? Signed request?) If not, anyone on their egress path can spoof.
33
+ - Human → admin console: how is admin access authenticated, and is that *separate* from user authN?
34
+
35
+ ### T — Tampering (data integrity)
36
+
37
+ Per boundary + per store:
38
+
39
+ - Data in transit: TLS version, cert validation, downgrade defenses. "We assume the internal network is safe" is where tampering happens.
40
+ - Data at rest: can a DB compromise *modify* records undetectably? Append-only audit stores + signed rows are the high-assurance pattern.
41
+ - Data in cache / queue: is message integrity validated? (HMAC on queue payloads, especially if they cross services with different trust levels.)
42
+ - Build artifacts: tampering between build and deploy. Signed provenance catches it.
43
+
44
+ ### R — Repudiation
45
+
46
+ - Is there an audit log that names the actor, the action, the resource, the time, and a request id?
47
+ - Are the actor's identity and the action tamper-evident in the log? A log the app writes to a DB the app can also update is repudiable.
48
+ - For high-value actions (payments, data exports, admin changes), is the log shipped to an append-only store? Separately from app storage?
49
+ - Agents acting on behalf of users: does the log name both? "User X, via agent Y, did Z at T."
50
+
51
+ ### I — Information disclosure
52
+
53
+ Per boundary + per store:
54
+
55
+ - Errors: what do error responses reveal? (See `docs/api-design.md` error taxonomy.)
56
+ - Side-channels: timing of login responses (does valid vs invalid username take different time?), response size, cache-hit timing.
57
+ - Logs: what fields are logged? Do they contain credentials / PII / secrets?
58
+ - Backups: who can read them? Are they encrypted separately from live?
59
+ - Debug endpoints: `/debug`, `/metrics`, `/health` — what do they expose? `/metrics` with unauthenticated Prometheus is fine for latency, not for business counters that hint at usage.
60
+ - URL leakage: does the URL contain sensitive data (tokens, email in query string)? URLs end up in logs, browser history, referer headers.
61
+ - Third-party telemetry: does Datadog / Sentry / LogRocket see data it shouldn't? (Session replay tools are notorious for capturing PII.)
62
+
63
+ ### D — Denial of service
64
+
65
+ - Rate limits exist per endpoint, per user, per IP (see `docs/api-design.md`).
66
+ - Resource exhaustion: big uploads, deep JSON, big arrays, catastrophic regex, zip bombs (see `docs/ingestion.md`).
67
+ - Downstream dep failures: what happens if the third-party API is down? Timeout, circuit-break, fallback? Synchronous calls with no timeout = cascading outage.
68
+ - Queue / cache exhaustion: can a user enqueue infinite work? Background jobs that fan out per user need per-user caps.
69
+ - Expensive operations (LLM calls, ML inference, PDF rendering): per-user and per-tenant quotas. Cost DoS is real.
70
+
71
+ ### E — Elevation of privilege
72
+
73
+ - AuthZ gaps: user role → admin role escalation. Mass assignment of `role` / `is_admin`. Server-side role check on every sensitive endpoint.
74
+ - Tenant escalation: cross-tenant data access. Row-level isolation enforced by policy engine, not by convention.
75
+ - Horizontal privilege (same role, other user's data): the IDOR / BOLA surface. Resource-scoped authZ.
76
+ - Agent / service escalation: a compromised less-privileged service calling a more-privileged one. Per-caller authZ at the callee.
77
+ - Infra-level: a compromised container breaking out to the host, or to other containers. Non-root, read-only FS, seccomp, network policy.
78
+
79
+ ## Negative-space questions
80
+
81
+ STRIDE catches the known categories. These catch what STRIDE misses:
82
+
83
+ - **What did we assume is safe?** List the implicit trust assumptions. "We trust the CDN", "we trust that service X has done authN", "we trust the user to provide their own tenant_id". Each is a fragile assumption to revisit.
84
+ - **What's the worst-case single compromise?** Pick one component — the web server, the DB, the build runner, a maintainer's laptop. How far does compromise spread? Is that acceptable, or does the design need more segmentation?
85
+ - **What's the attacker's goal?** Data theft (who pays for it?), financial fraud (how does it monetize?), denial (who benefits from us being offline?), reputational (activist / extortion). The feasible attacks depend on who'd try.
86
+ - **What changes in an incident?** Under compromise, can you freeze sessions, rotate secrets, disable endpoints? If the runbook starts with "we'll figure it out", design in the controls now.
87
+
88
+ ## Abuse cases — the flipside of use cases
89
+
90
+ For each primary use case, write the abuse twin:
91
+
92
+ - "User invites a friend" → "Attacker invites 10,000 friends to spam; legitimate invitee sees their address used as spam source."
93
+ - "User uploads a profile picture" → "Attacker uploads a polyglot SVG to execute script in another user's browser."
94
+ - "User requests a password reset" → "Attacker bulk-enumerates emails or sends reset-spam."
95
+ - "User exports their data" → "Attacker exfiltrates via unthrottled export endpoint."
96
+
97
+ One abuse twin per use case is enough at kickoff. Each surfaces a control that *should* be in the design but often isn't.
98
+
99
+ ## Agentic / LLM-specific threats (if in scope)
100
+
101
+ If the design includes LLM or agent components, add these to the walk:
102
+
103
+ - Prompt injection: untrusted content reaches the model. Can it alter behavior of subsequent tool calls?
104
+ - Excessive agency: what tools does the agent have access to? Tools that write (email, file, DB, shell) are the blast-radius questions. Read-only tools are low-stakes.
105
+ - Data poisoning: RAG indexes over user content — can a user plant content that affects another user's retrieval?
106
+ - Model theft / extraction: API designs that let attackers reconstruct model behavior.
107
+ - Cross-tenant context bleed: if the model sees data from tenant A during a tenant B session, even as a system prompt leak, it's a disclosure bug.
108
+
109
+ ## Output
110
+
111
+ A threat-modeling pass should produce:
112
+
113
+ - The DFD / trust-boundary sketch (prose or image).
114
+ - For each boundary / store: the STRIDE findings and the proposed mitigations.
115
+ - The refuse-list items that surfaced (if any).
116
+ - A short list of residual risks the team is knowingly accepting, with a reason.
117
+ - Follow-up items to file as issues (new controls, instrumentation, tests).
118
+
119
+ ---
120
+
121
+ ## Exit criteria
122
+
123
+ - DFD + boundaries are drawn.
124
+ - STRIDE is applied per boundary (not globally).
125
+ - Negative-space questions are answered.
126
+ - At least one abuse twin is written per primary use case.
127
+ - Residual risks are explicit and accepted in writing, not implicit.
128
+ - Design is ready for implementation — `rafter-code-review` will walk the PR when it lands.
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: rafter-skill-review
3
+ description: "Security review of a skill, plugin, or agent extension before you install it. Router skill: pick (a) installing a brand-new skill, (b) updating an already-installed skill, or (c) investigating one that looks suspicious, and Read the matching sub-doc. Pairs with `rafter skill review <path-or-url>` which emits a deterministic JSON report (secrets, URLs, high-risk shell, obfuscation signals). Run this BEFORE copying any third-party SKILL.md, MCP server manifest, Cursor rule, or agent config into your machine. No installation is safe until it has passed."
4
+ version: 0.1.0
5
+ allowed-tools: [Bash, Read, Grep, Glob, WebFetch]
6
+ ---
7
+
8
+ # Rafter Skill Review — Vet Before You Install
9
+
10
+ Skills are executable context. Installing one gives it Read, sometimes Bash, sometimes network — with your identity and your files. Treat installation the way you treat `curl | sh`: don't.
11
+
12
+ Before you copy any third-party `SKILL.md`, MCP manifest, Cursor rule, or agent extension into your machine, run this skill.
13
+
14
+ > This skill replaces `rafter agent audit-skill` (still usable but deprecated — emits a stderr warning and aliases to `rafter skill review`).
15
+
16
+ ---
17
+
18
+ ## Step 0: Always run the deterministic pass first
19
+
20
+ ```bash
21
+ rafter skill review <path-or-git-url> # emits JSON to stdout
22
+ rafter skill review <path> --format text # human-readable summary
23
+ ```
24
+
25
+ The command:
26
+ - pulls the skill (if a URL, does a shallow clone into a temp dir),
27
+ - runs `rafter scan local` over the tree,
28
+ - extracts URLs, high-risk shell patterns, obfuscation signals,
29
+ - reads `SKILL.md` frontmatter (`allowed-tools`, `version`, etc.),
30
+ - prints a structured JSON report — see `shared-docs/CLI_SPEC.md` §`rafter skill review`.
31
+
32
+ Exit code `0` means the deterministic pass found nothing. **That does NOT mean the skill is safe.** LLM prompt injection, sneaky data practices, and authorship fraud are invisible to regex. Always follow up with the Choose-Your-Adventure branch below.
33
+
34
+ ---
35
+
36
+ ## Choose Your Adventure
37
+
38
+ Pick exactly one branch. Read only that sub-doc — do not flood your context with all six.
39
+
40
+ ### (a) I am installing a brand-new skill
41
+
42
+ Use this when: you've never had this skill on this machine, and you want to know if it's safe to install for the first time.
43
+
44
+ **Walk in order:**
45
+
46
+ 1. **`Read docs/authorship-provenance.md`** — who wrote it, how old, how signed, how widely installed. Stop early if provenance is weak.
47
+ 2. **`Read docs/malware-indicators.md`** — grep for obfuscation, binary blobs, postinstall scripts, known-bad URL patterns.
48
+ 3. **`Read docs/prompt-injection.md`** — scan prose for hidden instructions, zero-width characters, conflicting directives in long files.
49
+ 4. **`Read docs/data-practices.md`** — which files/paths does it read and write, what network calls, does it silently escalate via `allowed-tools`.
50
+ 5. **`Read docs/telemetry.md`** — phone-home URLs, analytics SDKs, anonymous-but-trackable IDs.
51
+
52
+ Sign off only when every branch has a file:line answer. Partial confidence = don't install.
53
+
54
+ ### (b) I am updating a skill I already have installed
55
+
56
+ Use this when: a new version of a skill you already trust is out and you're about to overwrite the installed copy.
57
+
58
+ - **`Read docs/changelog-review.md`** — focuses on *what changed*: diff between old and new SKILL.md + sub-docs, new URLs, new shell, new tool grants, version-bump semantics. Provenance shifts (new maintainer, transferred repo, republished package) get their own checklist here.
59
+ - If the diff touches prompts, tools, or network → also walk `docs/prompt-injection.md` and `docs/data-practices.md` on the changed sections only.
60
+
61
+ ### (c) I am investigating a skill that already looks suspicious
62
+
63
+ Use this when: something smells wrong (someone reported it, the name is a typo-squat, it showed up uninstalled, a finding from step 0 alarmed you).
64
+
65
+ - **`Read docs/malware-indicators.md`** first — prioritize obfuscation and binary-blob checks.
66
+ - **`Read docs/prompt-injection.md`** — the skill may be weaponized against the installer, not the end user.
67
+ - **`Read docs/authorship-provenance.md`** — map the real author (not the claimed one), check other artifacts from the same account.
68
+ - **`Read docs/telemetry.md`** and **`docs/data-practices.md`** in parallel — data exfil is often what the attacker wants.
69
+
70
+ If any branch yields a concrete indicator: do not install. File the finding with `rafter issues create from-text`, or attach to an existing PR / ticket with file:line evidence.
71
+
72
+ ---
73
+
74
+ ## What this skill will NOT do
75
+
76
+ - It will not tell you a skill is "safe". There is no global safe list. Trust is per-install, per-machine, per-version.
77
+ - It will not replace `rafter scan`. The JSON report from step 0 is the evidence floor, not the ceiling.
78
+ - It will not evaluate skills you've already installed and run — by that point the exfil already happened. This is pre-install gating only.
79
+
80
+ ---
81
+
82
+ ## Fast path — copy-paste
83
+
84
+ ```bash
85
+ # Local path
86
+ rafter skill review ./third-party-skill/ --json > report.json
87
+
88
+ # Git URL (shallow-cloned into temp dir; removed after review)
89
+ rafter skill review https://github.com/acme/their-skill.git --json > report.json
90
+
91
+ # Human-readable
92
+ rafter skill review ./third-party-skill/
93
+ ```
94
+
95
+ If the command exits 1 → findings present → walk branch (a) or (c) above.
96
+ If exit 0 → deterministic pass clean → still walk branch (a) for a new install.
97
+
98
+ ## Decision rule
99
+
100
+ Install only if **all three** are true:
101
+
102
+ 1. `rafter skill review` exit 0 (or every finding is explained and accepted).
103
+ 2. The branch you walked has no unanswered questions.
104
+ 3. `allowed-tools` is narrower than or equal to what the skill's stated purpose requires.
105
+
106
+ If in doubt, don't install. Re-evaluating later is cheap; removing a backdoor is not.
@@ -0,0 +1,82 @@
1
+ # Authorship & Provenance
2
+
3
+ Who wrote the skill, how can you verify it, how long has it existed, and how widely is it already installed. A skill with perfect code and a brand-new pseudonymous author is still risky — provenance is the first filter, before reading a single line.
4
+
5
+ ## 1. Identify the claimed author
6
+
7
+ Check all of:
8
+ - `SKILL.md` frontmatter (`author`, `maintainer`, `url` fields if present).
9
+ - `package.json` / `pyproject.toml` `author`, `maintainers`, `repository`.
10
+ - Git history: `git log --format='%an <%ae>' | sort -u | head`.
11
+ - README "Author" section.
12
+
13
+ Mismatch between any of these = investigate before trusting any single source.
14
+
15
+ ## 2. Age and activity
16
+
17
+ - **Repo age**: `git log --reverse --format='%ai' | head -1`. A repo created last week, publishing a complex security skill, is not automatically malicious — but it deserves more scrutiny.
18
+ - **Number of independent contributors**: `git shortlog -sne`. One-author repos are common; zero-external-contributor repos that claim many users are suspicious.
19
+ - **Commit cadence**: bursts right before a release with no prior activity suggest a hijacked or squatted name.
20
+
21
+ ## 3. Signing and verification
22
+
23
+ - `git log --show-signature <ref>` — does the claimed maintainer actually sign?
24
+ - `gh release view <tag>` — are release artifacts signed / checksummed?
25
+ - For npm: `npm view <pkg> dist.integrity` and `npm audit signatures`.
26
+ - For PyPI: look for Sigstore `.sigstore` files on the release page, or check `pip install --require-hashes`.
27
+
28
+ Unsigned does not automatically mean bad. **Changed signatures** (used to sign, now doesn't) or **signature mismatch with claimed maintainer** is a hard reject.
29
+
30
+ ## 4. Distribution provenance
31
+
32
+ - **Registry page**: `npm view <pkg>`, `pip show <pkg>`, plugin marketplace page.
33
+ - **Download count / star count**: high numbers don't prove safety, but sudden spikes after a rename / transfer can indicate squatting.
34
+ - **Transferred ownership**: `npm view <pkg> maintainers` history, `pypi` project audit log, GitHub transfer events. A skill that changed hands recently is a classic supply-chain pattern — the new owner publishes a trojaned version to existing users.
35
+ - **Typo-squat check**: compare name to popular legitimate skills. Levenshtein distance of 1–2 from a well-known name, combined with recent registration, is a strong signal.
36
+
37
+ ## 5. Parallel artifacts from the same author
38
+
39
+ Look at the author's other repos / packages:
40
+
41
+ - Similar skills with credentials-adjacent behaviour? Pattern.
42
+ - Aggressive telemetry in every project? Pattern.
43
+ - Consistent style, history, maintainer responsiveness? Good signal.
44
+ - Prior CVEs, prior account bans? Hard signal against.
45
+
46
+ ```bash
47
+ gh api users/<login>/repos --jq '.[].full_name' | head -40
48
+ ```
49
+
50
+ Skim a few for the same malware-indicator red flags — if two of them trip, treat this one as untrusted regardless of its own code.
51
+
52
+ ## 6. Independent endorsement
53
+
54
+ A skill on its own repo's README can claim anything. Look for external signals:
55
+
56
+ - Referenced in a blog post, conference talk, or mainstream doc.
57
+ - Shipped as a recommended default by a tool's maintainers (not the skill author).
58
+ - Reviewed by a known security practitioner with evidence (post + date + sample output).
59
+
60
+ Absence of endorsement doesn't mean rejection, but presence of strong endorsement can lower the scrutiny level.
61
+
62
+ ## 7. Revocation readiness
63
+
64
+ Even trusted skills fail. Before you install:
65
+
66
+ - Know where the skill lives on disk (`rafter skill list --installed --json`).
67
+ - Know how to remove it (`rafter skill uninstall <name>` if rafter-authored, otherwise manual delete).
68
+ - Know what config files it might have written (walk `docs/data-practices.md` §2).
69
+ - Keep a fresh shell open to re-verify the install path after install.
70
+
71
+ ## 8. Checklist summary
72
+
73
+ Before proceeding to code-level review:
74
+
75
+ - [ ] Claimed author matches git history and registry metadata.
76
+ - [ ] Repo is at least a few releases old, OR endorsed by a trusted source.
77
+ - [ ] Commits are signed by the claimed maintainer (or signing is consistently absent).
78
+ - [ ] Ownership hasn't transferred recently without documented reason.
79
+ - [ ] Name is not a typo-squat of a well-known skill.
80
+ - [ ] Author's other artifacts don't trip the malware-indicator checklist.
81
+
82
+ Two or more gaps = rescope to "only install in a sandbox after deep code review", or reject.
@@ -0,0 +1,99 @@
1
+ # Changelog / Update Review
2
+
3
+ You trusted v1.2 last month. v1.3 came out. Most of your past trust is stale — you need to re-verify what changed, not re-verify everything. This doc is the diff-focused companion to the other sub-docs.
4
+
5
+ ## 1. Produce the diff
6
+
7
+ For a local copy:
8
+ ```bash
9
+ # If you have the old version installed and the new version in a directory:
10
+ diff -ru ~/.claude/skills/<name>/ /path/to/new-version/ > /tmp/skill.diff
11
+ ```
12
+
13
+ For a git-published skill:
14
+ ```bash
15
+ git -C /tmp/<skill>-old log --oneline
16
+ git -C /tmp/<skill>-old diff <old-tag>..<new-tag> > /tmp/skill.diff
17
+ ```
18
+
19
+ Skim top-to-bottom once. Then walk the sections below.
20
+
21
+ ## 2. What must be re-reviewed on every update
22
+
23
+ These categories always need a fresh walk on the new version:
24
+
25
+ 1. **`allowed-tools` changes** — widening by even one tool resets trust. Narrowing is fine.
26
+ 2. **New outbound URLs** — each one demands §3 of `docs/data-practices.md`.
27
+ 3. **New shell invocations** — walk `docs/malware-indicators.md` §2.
28
+ 4. **New filesystem writes or reads outside the previous set**.
29
+ 5. **New `WebFetch` / live-remote dependencies**.
30
+ 6. **New env vars read**.
31
+
32
+ Use:
33
+ ```bash
34
+ grep -E '^\+' /tmp/skill.diff | grep -E 'allowed-tools|https?://|curl|wget|Bash|WebFetch|writeFile|process\.env|os\.environ'
35
+ ```
36
+
37
+ ## 3. Version semantics
38
+
39
+ - **Patch bumps (x.y.Z)**: should be bugfixes + docs. A patch bump with new tools / URLs is a provenance red flag — the maintainer is either careless or pretending.
40
+ - **Minor bumps (x.Y.z)**: new feature work. Expect new code surface; re-walk the relevant sub-doc.
41
+ - **Major bumps (X.y.z)**: re-evaluate from scratch — treat the new version as a new skill. Walk branch (a) of the main SKILL.md.
42
+
43
+ If the skill has no versioning or a single rolling `latest` tag, it's effectively a major bump every time. Do not auto-update.
44
+
45
+ ## 4. Maintainer transfer / republish
46
+
47
+ The single highest-risk update pattern:
48
+
49
+ - Original maintainer transfers ownership (`npm owner add/rm`, GitHub transfer, PyPI project transfer).
50
+ - A dormant package springs back to life with a large version bump.
51
+ - Package is unpublished then republished (sometimes with a version hole filled in).
52
+
53
+ On any of these: treat as a new install. Re-walk `docs/authorship-provenance.md` from scratch. Do NOT reuse old trust.
54
+
55
+ ## 5. Silent changes to trust-adjacent files
56
+
57
+ A changelog may claim "docs only" while the actual diff includes:
58
+ - New entries in `scripts.postinstall` / `setup.py` install hook.
59
+ - New entries in `.claude/settings.json` if the skill distributes one.
60
+ - New entries in `.rafter.yml` defaults.
61
+ - Changes to bundled fixtures that become runtime data.
62
+
63
+ Grep the diff for changes to any file outside `*.md` and the skill's explicitly declared source paths.
64
+
65
+ ## 6. Dependency drift
66
+
67
+ If the skill ships deps:
68
+ - `package.json` / `package-lock.json` / `pyproject.toml` / `poetry.lock` / `requirements.txt`.
69
+ - Any new dep at a new major version = walk that dep's own provenance briefly.
70
+ - Any replaced dep (A → B) = check B's provenance.
71
+ - Any dep that resolves to a different registry (e.g. `--index-url` change) = reject-or-investigate.
72
+
73
+ Tools:
74
+ ```bash
75
+ npm diff <pkg>@<old> <pkg>@<new> # raw file-level diff
76
+ npm view <new-dep> # provenance of any newcomer
77
+ pip-audit # known CVEs in the new lockfile
78
+ ```
79
+
80
+ ## 7. Prompt / SKILL.md diffs
81
+
82
+ Even a "prose-only" diff can install a prompt-injection vector:
83
+ - Any newly inserted `Bash:` heredoc.
84
+ - New `<details>` sections.
85
+ - New `WebFetch` references.
86
+ - New "also run …", "after each step, …", "silently …" phrasing.
87
+
88
+ If the SKILL.md diff is non-trivial, walk `docs/prompt-injection.md` on the changed sections.
89
+
90
+ ## 8. Decision rule
91
+
92
+ Accept the update if **all** are true:
93
+
94
+ - The diff is small enough to read end-to-end without skipping.
95
+ - Every new capability (tool, URL, shell, write) is justified in the changelog and in the code.
96
+ - The maintainer identity is unchanged from the last trusted version.
97
+ - No trust-adjacent file silently changed.
98
+
99
+ Otherwise: pin to the previous version and file the concerns upstream. A pinned-old version that still works beats a new version that might exfil — every time.
@@ -0,0 +1,88 @@
1
+ # Data Practices
2
+
3
+ What the skill reads, what it writes, where it sends bytes. The goal: a complete map of the skill's I/O before installation.
4
+
5
+ > The JSON report from `rafter skill review` gives you URLs and some command patterns. This doc is the structured follow-up: enumerate surface, then decide.
6
+
7
+ ## 1. Filesystem reads
8
+
9
+ For every Read / Glob / Grep / `cat` the skill performs, answer:
10
+
11
+ | Question | Expected answer |
12
+ |----------|----------------|
13
+ | Is the path derived from user input? | Yes, and validated — or no, it's a fixed project path. |
14
+ | Does it glob `~/` or `/` roots? | Only with explicit exclusions of credential dirs. |
15
+ | Does it follow symlinks? | Only if documented and scoped. |
16
+ | Does it touch `~/.ssh`, `~/.aws`, `~/.gnupg`, `~/.config/gh`, `~/.netrc`, `~/.git-credentials`, browser profiles, password managers? | No. Any yes = reject. |
17
+
18
+ Flag: `fs.readFileSync`, `open(...)`, `readFile`, `fs.readdir`, `glob(...)` with patterns broader than the stated purpose requires.
19
+
20
+ ## 2. Filesystem writes
21
+
22
+ Every Write / `mv` / `cp` / `mkdir` needs justification:
23
+
24
+ - **In-repo writes**: fine, if the file is one the user expects the skill to produce.
25
+ - **Home-dir writes**: must be `~/.<skill-name>/` or equivalent scoped dir. Writes to `~/.bashrc`, shell rc files, `~/.config/systemd`, crontab, launchd plists are persistence = reject.
26
+ - **System-wide writes** (`/etc`, `/usr/local`): reject unless the skill is documented as a sysadmin tool AND requires explicit sudo with prompt.
27
+
28
+ Search the tree:
29
+ ```bash
30
+ rg -n 'writeFileSync|fs\.write|open\([^)]*"[wa]"|createWriteStream|\.mkdirSync' <skill>
31
+ rg -n '\.bashrc|\.zshrc|\.profile|crontab|systemctl|launchctl' <skill>
32
+ ```
33
+
34
+ ## 3. Network calls
35
+
36
+ List every outbound URL the skill touches. For each, answer:
37
+
38
+ 1. Is the domain owned by the claimed maintainer? (Check WHOIS / org owner.)
39
+ 2. Is it HTTPS? Pinned to a specific path and version?
40
+ 3. Is it called at install time, at run time, or both?
41
+ 4. Does it include any data from the user's repo or machine as query/body?
42
+ 5. Is failure handled by **stopping**, not by falling back to a plain-text alternative?
43
+
44
+ Red flags:
45
+ - Outbound POSTs whose body includes file contents, env vars, or user prompts.
46
+ - `User-Agent` strings that encode a machine ID or repo name.
47
+ - Fallback chains: "try HTTPS, else HTTP, else cache" — the else branches are a downgrade attack.
48
+
49
+ ## 4. Environment variable access
50
+
51
+ Every `process.env.FOO` / `os.environ["FOO"]` is a potential credential sink. Enumerate them and split:
52
+
53
+ - **Expected**: `RAFTER_API_KEY` in a rafter-adjacent skill, `OPENAI_API_KEY` in an AI tooling skill.
54
+ - **Unexpected**: `AWS_SECRET_ACCESS_KEY`, `GITHUB_TOKEN`, `NPM_TOKEN`, `ANTHROPIC_API_KEY`, `DATABASE_URL`. These should never be read by a skill unless that's the skill's stated purpose.
55
+ - **Leaky**: any env var that's then passed into a network call (step 3) or into a shell invocation (step 5).
56
+
57
+ ## 5. Shell / tool invocation
58
+
59
+ Skills declare `allowed-tools` in frontmatter. Reconcile:
60
+
61
+ - **Stated purpose vs. allowed-tools**: a "code review" skill that declares `allowed-tools: [Bash, Write, WebFetch]` is asking for more than the purpose justifies.
62
+ - **Minimal grant**: `Read, Glob, Grep` is usually enough for analysis skills. Each extra tool (`Bash`, `Write`, `WebFetch`, `Edit`) needs a sentence of justification in SKILL.md.
63
+ - **Shell calls in `Bash`**: for every shell command the skill invokes, re-run `rafter skill review` worth of checks against that command specifically.
64
+
65
+ ## 6. Silent escalation
66
+
67
+ Patterns where the skill widens its own surface at run time:
68
+
69
+ - Adds new tools via MCP server registration.
70
+ - Writes to `settings.json` / `.claude/settings.json` to grant permissions.
71
+ - Modifies `.rafter.yml` or other policy files.
72
+ - Changes shell rc files to export new env vars / aliases.
73
+
74
+ Any of these = reject unless they are the skill's stated, headline feature (e.g., a skill whose whole job is installing MCP servers).
75
+
76
+ ## 7. Data classification of outputs
77
+
78
+ For any data the skill emits to stdout / files / network, classify:
79
+
80
+ - **Public**: analysis results, counts, categories. Safe.
81
+ - **Repo-private**: code snippets, file names, diffs. Only OK on HTTPS to a maintainer-owned URL the user has already trusted.
82
+ - **Credential-adjacent**: .env files, `~/.aws/config`, keychain excerpts. Should never leave the machine via a skill.
83
+
84
+ ---
85
+
86
+ ## Decision rule
87
+
88
+ Write out, in one paragraph, the skill's total I/O surface: read-set, write-set, outbound URLs, env vars. If that paragraph has any surprises relative to the skill's stated purpose, reject. If every item is expected and scoped, proceed to `docs/telemetry.md`.