@ericrisco/rsc 0.1.51 → 0.1.53

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: security-scan
3
- description: "Use when running automated security scanners over a repo or app and turning the raw output into a triaged, ranked, gate-able report: scan for vulnerabilities before shipping, audit dependencies/lockfiles for known CVEs, find secrets committed to the tree or git history, run SAST, or wire scanners into CI. Triggers: 'scan this repo for vulnerabilities', 'check my package-lock for CVEs', 'did anyone commit AWS keys', 'scan git history for leaked keys', 'my lockfile has a transitive CVE', 'is aquasecurity/trivy-action@latest safe', 'set up Semgrep/gitleaks to fail CI', 'escanea el repo en busca de vulnerabilidades', 'audita las dependencias', 'analitza les dependències'. NOT threat-modeling, OWASP design reasoning, or authoring the fix (that is secure-coding)."
3
+ description: "Use when automated scanners drive a security sweep of a repo or app — SAST, dependency/lockfile CVEs, secrets in the tree or git history, IaC misconfig — and the raw output has to become one deduped, exploitability-ranked report CI can gate on. NOT threat-modeling, OWASP design reasoning, or hand-authoring the fix (that is `secure-coding`)."
4
4
  tags: [security, sast, sca, secrets, scanning, owasp]
5
5
  recommends: [secure-coding, github-actions, verify]
6
6
  origin: risco
@@ -15,40 +15,28 @@ finding comes from a **tool run**, not a hunch — if you are reasoning about a
15
15
  design or hand-writing a fix, that is [`secure-coding`](../secure-coding/SKILL.md),
16
16
  not this skill.
17
17
 
18
- Your job is orchestration + triage. Not eyeballing code, not authoring patches.
19
-
20
- ## Operating posture
21
-
22
- - **Read-only by default.** Scan, triage, report. Apply fixes (version bumps,
23
- rotation, `.gitignore` edits) only when the user asks. *Why:* a security sweep
24
- that silently mutates the tree destroys the evidence and the trust.
25
- - **Machine-first.** Every finding must trace to a scanner run with a `ruleId`
26
- and a source location. *Why:* "I think this looks injectable" is design
27
- reasoning — route it to `secure-coding`. This skill ships reproducible output.
28
- - **Pin and verify your scanners.** Pin exact versions, verify checksums/SHAs,
29
- never pull `@latest` GitHub Actions. *Why:* in **March 2026 Trivy was
30
- supply-chain compromised** — malicious releases `v0.69.4/0.69.5/0.69.6` and a
31
- hijacked `aquasecurity/trivy-action` exfiltrated CI secrets. Your scanner runs
32
- with repo + CI-secret access; an unpinned scanner is itself the attack surface.
33
- - **SARIF everything.** Make every tool emit SARIF (or JSON you normalize to it).
34
- *Why:* a common schema is what lets you merge four tools, dedupe, and feed one
35
- artifact into CI instead of four incompatible logs.
36
- - **Triage before you report.** Raw scanner output is high-noise. Rank by
37
- exploitability and dedupe overlap; never dump 400 raw findings on the user.
38
-
39
- ## The four scan classes
40
-
41
- | Class | What it catches | Primary tool | Backup / fast pass |
42
- |---|---|---|---|
43
- | **SAST** | injection, XSS, path traversal in *first-party* code | Semgrep | — |
44
- | **SCA / deps** | known CVEs in dependency manifests + lockfiles | osv-scanner | `npm audit`, `pip-audit` |
45
- | **Secrets** | credentials in the tree **or git history** | gitleaks (speed) | TruffleHog (depth + live verification) |
46
- | **Misconfig / IaC** | Dockerfile, k8s, Terraform, exposed config | Trivy `config` | Semgrep rulesets |
47
-
48
- ### Tool selection by ecosystem
49
-
50
- Pick by what is in the repo. This is the real branch point — match the tool to
51
- the manifest, do not run everything everywhere.
18
+ Your job is orchestration + triage: every finding traces to a scanner run with a
19
+ `ruleId` and a source location, so the output is reproducible. Not eyeballing
20
+ code, not authoring patches.
21
+
22
+ **Read-only by default.** Scan, triage, report. Apply fixes (version bumps,
23
+ rotation, `.gitignore` edits) only when the user asks — a security sweep that
24
+ silently mutates the tree destroys the evidence and the trust.
25
+
26
+ **Pin and verify your scanners.** Exact versions, verified checksums/SHAs, never
27
+ `@latest` GitHub Actions. In **March 2026 Trivy was supply-chain compromised** —
28
+ malicious releases `v0.69.4/0.69.5/0.69.6` and a hijacked
29
+ `aquasecurity/trivy-action` exfiltrated CI secrets. Your scanner runs with repo +
30
+ CI-secret access; an unpinned scanner is itself the attack surface.
31
+
32
+ ## Scan classes and tool selection
33
+
34
+ Four classes: **SAST** (injection, XSS, path traversal in *first-party* code),
35
+ **SCA / deps** (known CVEs in dependency manifests + lockfiles), **Secrets**
36
+ (credentials in the tree **or git history**), **Misconfig / IaC** (Dockerfile,
37
+ k8s, Terraform, exposed config). Pick tools by what is in the repo. This is the
38
+ real branch point — match the tool to the manifest, do not run everything
39
+ everywhere.
52
40
 
53
41
  | Repo contains | SAST | SCA | Secrets | Misconfig |
54
42
  |---|---|---|---|---|
@@ -56,15 +44,17 @@ the manifest, do not run everything everywhere.
56
44
  | Python (`poetry.lock`/`requirements.txt`) | Semgrep | osv-scanner + `pip-audit` (fast) | gitleaks → TruffleHog | Trivy |
57
45
  | Go (`go.mod`/`go.sum`) | Semgrep | osv-scanner (+ `govulncheck` for reachability) | gitleaks | Trivy |
58
46
  | Containers (`Dockerfile`, images) | — | Trivy `fs`/`image` | Trivy `--scanners secret` | Trivy `config` |
59
- | IaC (Terraform/k8s/Helm) | Semgrep (IaC rules) | — | gitleaks | Trivy `config` |
47
+ | IaC (Terraform/k8s/Helm) | Semgrep (IaC rules) | — | gitleaks | Trivy `config`, Semgrep rulesets |
60
48
  | Monorepo (mixed) | Semgrep `auto` | osv-scanner (multi-ecosystem) | gitleaks → TruffleHog | Trivy |
61
49
 
62
50
  Full install (pinned), flag matrix, and suppression syntax: `references/tools.md`.
63
51
 
64
52
  ## Run recipes
65
53
 
66
- All recipes emit SARIF or JSON so they merge into one report. **Pin the version
67
- shown** — the placeholders below mark where to lock an exact tag/digest.
54
+ All recipes emit SARIF (or JSON you normalize to it) — a common schema is what
55
+ lets you merge four tools, dedupe, and feed one artifact into CI instead of four
56
+ incompatible logs. **Pin the version shown**; the placeholders below mark where
57
+ to lock an exact tag/digest.
68
58
 
69
59
  ### SAST — Semgrep
70
60
 
@@ -107,10 +97,10 @@ gitleaks detect --redact --report-format sarif --report-path secrets.sarif
107
97
  trufflehog git file://. --only-verified --json > trufflehog.json
108
98
  ```
109
99
 
110
- ### Misconfig / IaC — Trivy (PINNED — see the caveat)
100
+ ### Misconfig / IaC — Trivy (PINNED — see the caveat above)
111
101
 
112
102
  Trivy scans filesystems, images, and IaC and finds transitive CVEs `npm audit`
113
- misses. After the March 2026 compromise, **never** run an unpinned Trivy.
103
+ misses.
114
104
 
115
105
  ```bash
116
106
  # Pin the EXACT version (NOT v0.69.4/.5/.6 — those were the malicious releases).
@@ -200,17 +190,17 @@ Emit one `security-scan-report.json` — the machine-checkable contract CI gates
200
190
 
201
191
  ## Anti-patterns
202
192
 
203
- | Rationalization | Reality |
193
+ | Anti-pattern | Do instead |
204
194
  |---|---|
205
- | "Pull `aquasecurity/trivy-action@latest`, it's official." | March 2026: a hijacked tag stole CI secrets. Pin a full SHA, verify provenance. |
206
- | "Every scanner finding is a bug to fix." | Most are noise. Rank by reachable + exposed + sensitive sink; report the few that matter. |
207
- | "Scanned the working tree, no secrets." | History holds the deleted keys. Scan git history; a removed-in-HEAD key is still leaked and live. |
208
- | "`npm audit` is clean, deps are fine." | Native auditors miss transitive CVEs. Run osv-scanner/Trivy too; native is the fast pass, not the only pass. |
209
- | "Commit a blanket `.semgrepignore` to quiet CI." | A blanket ignore hides the next real bug. Suppress per-finding with a written justification + expiry. |
210
- | "We found a verified key, I deleted it from the file." | Deleting ≠ safe. Rotate the credential first, then scrub history. The committed value is already compromised. |
211
- | "Trust the SARIF `level`, that's the severity." | Tools disagree. Normalize to one scale before you rank or gate. |
212
- | "Dump all four tool outputs in the PR, let the reviewer sort it." | The reviewer won't. Merge, dedupe, rank, and emit one report. |
213
- | "Run the scan; it'll auto-fix the deps." | Read-only by default. Propose bumps; apply only when asked — never mutate during a sweep. |
195
+ | Pulling `aquasecurity/trivy-action@latest` because it is the official action | March 2026: a hijacked tag stole CI secrets. Pin a full SHA, verify provenance. |
196
+ | Treating every scanner finding as a bug to fix | Most are noise. Rank by reachable + exposed + sensitive sink; report the few that matter. |
197
+ | Calling the repo clean after scanning only the working tree | History holds the deleted keys. Scan git history; a removed-in-HEAD key is still leaked and live. |
198
+ | Declaring deps fine because `npm audit` is clean | Native auditors miss transitive CVEs. Run osv-scanner/Trivy too; native is the fast pass, not the only pass. |
199
+ | Committing a blanket `.semgrepignore` to quiet CI | A blanket ignore hides the next real bug. Suppress per-finding with a written justification + expiry. |
200
+ | Deleting a verified key from the file and moving on | Deleting ≠ safe. Rotate the credential first, then scrub history. The committed value is already compromised. |
201
+ | Taking the SARIF `level` as the severity | Tools disagree. Normalize to one scale before you rank or gate. |
202
+ | Dumping all four tool outputs in the PR for the reviewer to sort | The reviewer won't. Merge, dedupe, rank, and emit one report. |
203
+ | Letting the scan auto-fix the deps it finds | Read-only by default. Propose bumps; apply only when asked — never mutate during a sweep. |
214
204
 
215
205
  ## Project grounding (02-DOCS + CLAUDE.md)
216
206
 
@@ -218,23 +208,12 @@ In a project with a `02-DOCS/` layer (the [`harness`](../harness/SKILL.md)
218
208
  Karpathy wiki), record the scanner choices, pinned versions, gate thresholds, and
219
209
  any accepted-risk suppressions in `02-DOCS/wiki/stack/security-scan.md`, and index
220
210
  it in `02-DOCS/wiki/index.md` (the Knowledge map; root `CLAUDE.md` keeps only a short
221
- pointer to it). Read it first on every run so the
222
- next agent inherits the pinned tools and thresholds instead of re-deriving them.
223
- No `02-DOCS/`? Skip silently. Conventions are recorded, not gated — never block
224
- the scan on this.
211
+ pointer to it). Read it first on every run so the next agent inherits the pinned
212
+ tools and thresholds instead of re-deriving them. No `02-DOCS/`? Skip silently.
213
+ Conventions are recorded, not gated — never block the scan on this.
225
214
 
226
215
  ## See Also
227
216
 
228
- - [`secure-coding`](../secure-coding/SKILL.md) — the human-reasoning sibling:
229
- threat-model a feature, hand-write the vulnerable→fixed diff. *If the answer
230
- comes from a tool run it's this skill; if it comes from reasoning about the
231
- design it's secure-coding.*
232
- - [`review`](../review/SKILL.md) — adversarial review of a diff against a spec.
233
- - [`code-review`](../code-review/SKILL.md) — general correctness/quality review.
234
- - [`verify`](../verify/SKILL.md) — the broader lint/type/test green gate this
235
- feeds into.
236
- - **References** — `references/tools.md` (pinned installs, flag matrix,
237
- suppression syntax); `references/triage.md` (ranking rubric, dedupe keying,
238
- severity map, full report schema).
239
- </content>
240
- </invoke>
217
+ Reviewing a diff rather than scanning a repo: [`code-review`](../code-review/SKILL.md)
218
+ for correctness and quality, [`review`](../review/SKILL.md) for adversarial review
219
+ against a spec.
@@ -95,4 +95,3 @@ trivy image --format sarif --output trivy-img.sarif <pinned-image@sha256:...>
95
95
  - Every recipe emits SARIF 2.1.0 so findings merge into one report. Where a tool
96
96
  only emits native JSON (`npm audit`, `pip-audit`, TruffleHog), normalize it to
97
97
  the report schema in `triage.md` rather than gating on its raw shape.
98
- </content>
@@ -90,4 +90,3 @@ This is the contract `scripts/verify.sh` gates on.
90
90
  - **Gate:** any `findings[]` with `status: "open"` and `severity: "critical"`
91
91
  → fail. Strict mode also fails on `open` + `high`. `suppressed`/`fixed` never
92
92
  fail. An empty/clean report exits `0`.
93
- </content>