@ericrisco/rsc 4.0.5 → 4.1.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 (201) hide show
  1. package/README.md +4 -4
  2. package/manifest.json +78 -84
  3. package/package.json +1 -1
  4. package/scripts/lib/default-skill-floor.js +5 -1
  5. package/scripts/lib/domains.js +1 -1
  6. package/scripts/lib/recommend.js +1 -1
  7. package/scripts/lib/retired-skills.js +4 -0
  8. package/scripts/skill-migration-brief.md +1 -1
  9. package/scripts/verify.sh +20 -0
  10. package/skills/accessibility/evals/README.md +1 -1
  11. package/skills/accessibility/evals/cases.yaml +1 -1
  12. package/skills/agent-safety/SKILL.md +2 -2
  13. package/skills/agent-safety/evals/README.md +1 -1
  14. package/skills/agent-safety/evals/cases.yaml +1 -1
  15. package/skills/analyze/evals/README.md +1 -1
  16. package/skills/analyze/evals/cases.yaml +2 -2
  17. package/skills/angular/SKILL.md +1 -1
  18. package/skills/api-connector-builder/SKILL.md +1 -1
  19. package/skills/api-design/SKILL.md +3 -3
  20. package/skills/api-design/evals/cases.yaml +1 -1
  21. package/skills/automation-strategy/SKILL.md +1 -1
  22. package/skills/automation-strategy/evals/README.md +1 -1
  23. package/skills/automation-strategy/evals/cases.yaml +2 -2
  24. package/skills/automation-strategy/references/orchestration-and-antipatterns.md +1 -1
  25. package/skills/aws-essentials/SKILL.md +3 -3
  26. package/skills/aws-essentials/evals/cases.yaml +2 -2
  27. package/skills/backups/SKILL.md +2 -2
  28. package/skills/backups/evals/cases.yaml +2 -2
  29. package/skills/bash-scripting/SKILL.md +1 -1
  30. package/skills/building-agents/SKILL.md +2 -2
  31. package/skills/building-agents/evals/cases.yaml +2 -2
  32. package/skills/chrome-extension/SKILL.md +1 -1
  33. package/skills/cloudflare/SKILL.md +1 -1
  34. package/skills/code-review/SKILL.md +2 -2
  35. package/skills/code-review/evals/cases.yaml +2 -2
  36. package/skills/compliance/SKILL.md +3 -3
  37. package/skills/compliance/evals/cases.yaml +1 -1
  38. package/skills/constitution/SKILL.md +2 -2
  39. package/skills/constitution/evals/README.md +2 -2
  40. package/skills/constitution/evals/cases.yaml +2 -2
  41. package/skills/constitution/references/constitution-template.md +1 -1
  42. package/skills/cpp/SKILL.md +2 -2
  43. package/skills/cpp/evals/README.md +1 -1
  44. package/skills/cpp/evals/cases.yaml +2 -2
  45. package/skills/csharp-dotnet/SKILL.md +3 -3
  46. package/skills/csharp-dotnet/evals/cases.yaml +1 -1
  47. package/skills/csharp-dotnet/references/aspnetcore.md +1 -1
  48. package/skills/data-policy/SKILL.md +2 -2
  49. package/skills/data-policy/evals/README.md +1 -1
  50. package/skills/data-policy/evals/cases.yaml +1 -1
  51. package/skills/debug/SKILL.md +1 -1
  52. package/skills/debug/evals/README.md +1 -1
  53. package/skills/decision-challenge/SKILL.md +2 -2
  54. package/skills/decision-challenge/evals/cases.yaml +1 -1
  55. package/skills/deployment/SKILL.md +2 -2
  56. package/skills/deployment/evals/README.md +1 -1
  57. package/skills/deployment/evals/cases.yaml +2 -2
  58. package/skills/django/SKILL.md +2 -2
  59. package/skills/django/evals/README.md +1 -1
  60. package/skills/django/evals/cases.yaml +1 -1
  61. package/skills/django/references/security.md +1 -1
  62. package/skills/docker/SKILL.md +3 -3
  63. package/skills/docker/evals/cases.yaml +1 -1
  64. package/skills/dynamodb/SKILL.md +2 -2
  65. package/skills/electron/SKILL.md +1 -1
  66. package/skills/electron/references/packaging-and-updates.md +1 -1
  67. package/skills/email-connector/SKILL.md +2 -2
  68. package/skills/email-deliverability/SKILL.md +1 -1
  69. package/skills/error-handling/SKILL.md +1 -1
  70. package/skills/expo/SKILL.md +2 -2
  71. package/skills/fastapi/SKILL.md +4 -4
  72. package/skills/fastapi/evals/README.md +2 -2
  73. package/skills/fastapi/evals/cases.yaml +2 -2
  74. package/skills/fastapi/references/security.md +2 -2
  75. package/skills/firebase/SKILL.md +1 -1
  76. package/skills/flutter/SKILL.md +1 -1
  77. package/skills/flutter/evals/cases.yaml +2 -2
  78. package/skills/fly-io/SKILL.md +1 -1
  79. package/skills/gamedev-multiplayer/SKILL.md +1 -1
  80. package/skills/gamedev-multiplayer/evals/README.md +1 -1
  81. package/skills/gamedev-multiplayer/evals/cases.yaml +2 -2
  82. package/skills/gamedev-shipping/SKILL.md +1 -1
  83. package/skills/gcp-essentials/SKILL.md +2 -2
  84. package/skills/gcp-essentials/evals/README.md +1 -1
  85. package/skills/gcp-essentials/evals/cases.yaml +2 -2
  86. package/skills/gdpr-privacy/SKILL.md +2 -2
  87. package/skills/gdpr-privacy/evals/cases.yaml +1 -1
  88. package/skills/github-actions/SKILL.md +2 -2
  89. package/skills/go/SKILL.md +4 -4
  90. package/skills/go/evals/README.md +1 -1
  91. package/skills/go/evals/cases.yaml +2 -2
  92. package/skills/google-workspace/SKILL.md +2 -2
  93. package/skills/hetzner/SKILL.md +1 -1
  94. package/skills/htmx/SKILL.md +4 -4
  95. package/skills/htmx/evals/cases.yaml +2 -2
  96. package/skills/implement/SKILL.md +1 -1
  97. package/skills/init/SKILL.md +2 -2
  98. package/skills/init/evals/cases.yaml +2 -2
  99. package/skills/init/references/discovery.md +1 -1
  100. package/skills/init/references/recommend-skills.md +5 -5
  101. package/skills/java/SKILL.md +3 -3
  102. package/skills/java/evals/README.md +1 -1
  103. package/skills/java/evals/cases.yaml +2 -2
  104. package/skills/laravel/SKILL.md +3 -3
  105. package/skills/laravel/evals/README.md +1 -1
  106. package/skills/laravel/evals/cases.yaml +1 -1
  107. package/skills/marketing/evals/README.md +1 -1
  108. package/skills/marketing/evals/cases.yaml +1 -1
  109. package/skills/mongodb/SKILL.md +2 -2
  110. package/skills/mongodb/evals/README.md +1 -1
  111. package/skills/mongodb/evals/cases.yaml +2 -2
  112. package/skills/nextjs/SKILL.md +3 -3
  113. package/skills/nextjs/evals/cases.yaml +2 -2
  114. package/skills/nextjs/references/security.md +2 -2
  115. package/skills/notion-connector/SKILL.md +3 -3
  116. package/skills/notion-connector/evals/README.md +1 -1
  117. package/skills/notion-connector/evals/cases.yaml +2 -2
  118. package/skills/php/SKILL.md +4 -4
  119. package/skills/php/evals/README.md +1 -1
  120. package/skills/php/evals/cases.yaml +1 -1
  121. package/skills/plan/evals/README.md +1 -1
  122. package/skills/postgresdb/SKILL.md +1 -1
  123. package/skills/postgresdb/evals/README.md +1 -1
  124. package/skills/postgresdb/evals/cases.yaml +2 -2
  125. package/skills/presentations/evals/README.md +1 -1
  126. package/skills/python/SKILL.md +3 -3
  127. package/skills/python/evals/README.md +1 -1
  128. package/skills/python/evals/cases.yaml +2 -2
  129. package/skills/rag/scripts/verify.sh +1 -1
  130. package/skills/review/SKILL.md +2 -2
  131. package/skills/review/evals/cases.yaml +3 -3
  132. package/skills/ruby/SKILL.md +1 -1
  133. package/skills/rust/SKILL.md +2 -2
  134. package/skills/rust/evals/README.md +1 -1
  135. package/skills/rust/evals/cases.yaml +2 -2
  136. package/skills/security-audit/SKILL.md +186 -0
  137. package/skills/security-audit/evals/cases.yaml +95 -0
  138. package/skills/security-audit/references/auditor-safety.md +69 -0
  139. package/skills/security-audit/references/classes/README.md +225 -0
  140. package/skills/security-audit/references/classes/ai-and-llm.md +247 -0
  141. package/skills/security-audit/references/classes/client-side.md +181 -0
  142. package/skills/security-audit/references/classes/cloud-and-deployment.md +167 -0
  143. package/skills/security-audit/references/classes/data-isolation.md +161 -0
  144. package/skills/security-audit/references/classes/desktop-mobile-ipc.md +167 -0
  145. package/skills/security-audit/references/classes/memory-and-binary.md +230 -0
  146. package/skills/security-audit/references/classes/protocols-and-messaging.md +151 -0
  147. package/skills/security-audit/references/classes/resource-exhaustion.md +141 -0
  148. package/skills/security-audit/references/classes/supply-chain.md +147 -0
  149. package/skills/security-audit/references/classes/web-and-auth.md +238 -0
  150. package/skills/security-audit/references/coverage-ledger.md +172 -0
  151. package/skills/security-audit/references/fixes-by-stack.md +972 -0
  152. package/skills/security-audit/references/fixing.md +200 -0
  153. package/skills/security-audit/references/hunting.md +146 -0
  154. package/skills/security-audit/references/isolated-execution.md +85 -0
  155. package/skills/security-audit/references/platforms.md +650 -0
  156. package/skills/security-audit/references/reconnaissance.md +73 -0
  157. package/skills/security-audit/references/resuming.md +55 -0
  158. package/skills/security-audit/references/scanners.md +347 -0
  159. package/skills/{secure-coding → security-audit}/references/secrets-and-supply-chain.md +78 -34
  160. package/skills/security-audit/references/secrets-discipline.md +173 -0
  161. package/skills/{secure-coding → security-audit}/references/threat-modeling.md +80 -32
  162. package/skills/security-audit/references/verification.md +118 -0
  163. package/skills/security-audit/schema/findings.schema.json +178 -0
  164. package/skills/security-audit/scripts/render-report.mjs +311 -0
  165. package/skills/security-audit/scripts/validate-findings.mjs +508 -0
  166. package/skills/skill-scout/scripts/verify.sh +1 -1
  167. package/skills/source-grounded-development/evals/cases.yaml +1 -1
  168. package/skills/specify/evals/README.md +1 -1
  169. package/skills/spring-boot/SKILL.md +3 -3
  170. package/skills/spring-boot/evals/README.md +1 -1
  171. package/skills/spring-boot/evals/cases.yaml +1 -1
  172. package/skills/spring-boot/references/security.md +1 -1
  173. package/skills/stripe/SKILL.md +2 -2
  174. package/skills/suggest/evals/cases.yaml +2 -2
  175. package/skills/supabase/SKILL.md +1 -1
  176. package/skills/tauri/SKILL.md +2 -2
  177. package/skills/testing-go/SKILL.md +1 -1
  178. package/skills/typescript/SKILL.md +2 -2
  179. package/skills/verify/SKILL.md +3 -3
  180. package/skills/verify/evals/README.md +2 -2
  181. package/skills/verify/evals/cases.yaml +2 -2
  182. package/skills/vue-nuxt/SKILL.md +2 -2
  183. package/skills/webhooks/SKILL.md +2 -2
  184. package/skills/wordpress/SKILL.md +2 -2
  185. package/skills/wordpress/evals/README.md +1 -1
  186. package/skills/wordpress/evals/cases.yaml +1 -1
  187. package/skills/worktrees/evals/README.md +1 -1
  188. package/targets/clone-bootstrap.mjs +1 -1
  189. package/targets/commands.js +1 -1
  190. package/skills/secure-coding/SKILL.md +0 -336
  191. package/skills/secure-coding/evals/README.md +0 -68
  192. package/skills/secure-coding/evals/cases.yaml +0 -55
  193. package/skills/secure-coding/references/authn-authz.md +0 -249
  194. package/skills/secure-coding/references/owasp-by-stack.md +0 -574
  195. package/skills/secure-coding/scripts/verify.sh +0 -208
  196. package/skills/security-scan/SKILL.md +0 -219
  197. package/skills/security-scan/evals/README.md +0 -14
  198. package/skills/security-scan/evals/cases.yaml +0 -50
  199. package/skills/security-scan/references/tools.md +0 -97
  200. package/skills/security-scan/references/triage.md +0 -92
  201. package/skills/security-scan/scripts/verify.sh +0 -108
@@ -1,208 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- # ============================================================================
5
- # NAME
6
- # verify.sh — secure-coding application-security gate
7
- #
8
- # USAGE
9
- # ./verify.sh
10
- # Run from the ROOT of YOUR project (the repo you are shipping), NOT from
11
- # the skills repository. It auto-detects your stack from the manifests it
12
- # finds (pyproject.toml / requirements*.txt / package.json / go.mod /
13
- # pubspec.yaml) and runs the matching auditors.
14
- #
15
- # WHAT IT DOES
16
- # 1. Secret scan — gitleaks over the working tree (and git history when
17
- # inside a git repo).
18
- # 2. SAST — semgrep ERROR rules (and informational WARNINGs).
19
- # 3. Dependency CVEs — per-stack: pip-audit (or `uvx pip-audit`),
20
- # osv-scanner/npm/pnpm/yarn, govulncheck,
21
- # dart pub outdated (informational).
22
- # Each tool is DETECTED first; if it is missing the step is SKIPPED with a
23
- # yellow warning (never a failure). The script exits non-zero ONLY on real
24
- # high/critical findings.
25
- #
26
- # GUARANTEES
27
- # - Idempotent and read-only: it never writes to the repo and never auto-fixes.
28
- # - Network access only where a tool inherently needs it (CVE feeds).
29
- # - semgrep --config=auto (which fetches remote rules) is OPT-IN via the
30
- # SECURE_CODING_SEMGREP_AUTO=1 env var; without it, semgrep runs only when
31
- # a local config is present.
32
- # - Portable to stock macOS bash 3.2 (no mapfile, no associative arrays).
33
- #
34
- # ENV TOGGLES
35
- # SECURE_CODING_SEMGREP_AUTO=1 Enable semgrep's network-fetched "auto" rules.
36
- # NO_COLOR=1 Disable ANSI color output.
37
- #
38
- # EXIT CODES
39
- # 0 No high/critical findings (skips and informational warnings are fine).
40
- # 1 At least one real high/critical finding — resolve before merge.
41
- # ============================================================================
42
-
43
- RED=$'\033[31m'; YEL=$'\033[33m'; GRN=$'\033[32m'; RST=$'\033[0m'
44
- if [ -n "${NO_COLOR:-}" ]; then RED=""; YEL=""; GRN=""; RST=""; fi
45
-
46
- FAILED=0
47
- warn() { printf '%s[skip]%s %s\n' "$YEL" "$RST" "$*" >&2; }
48
- ok() { printf '%s[ok]%s %s\n' "$GRN" "$RST" "$*"; }
49
- bad() { printf '%s[FAIL]%s %s\n' "$RED" "$RST" "$*" >&2; FAILED=1; }
50
- info() { printf '%s[info]%s %s\n' "$YEL" "$RST" "$*"; }
51
- have() { command -v "$1" >/dev/null 2>&1; }
52
- section() { printf '\n=== %s ===\n' "$*"; }
53
-
54
- # need <tool> <install-hint> : guard a tool block. Returns 0 if present,
55
- # else prints a skip warning and returns 1 so the caller can skip the block.
56
- need() {
57
- if have "$1"; then
58
- return 0
59
- fi
60
- warn "$1 not installed (install: $2)"
61
- return 1
62
- }
63
-
64
- # ----------------------------------------------------------------------------
65
- # 1. Secrets — gitleaks
66
- # ----------------------------------------------------------------------------
67
- section "Secrets (gitleaks)"
68
- if need gitleaks "brew install gitleaks / https://github.com/gitleaks/gitleaks"; then
69
- # gitleaks v8.19+ split scanning: `dir` walks the working-tree FILES, while
70
- # `git` scans commit HISTORY (patches). The deprecated `detect` == `git`
71
- # (history only) and would MISS an unstaged secret in a working file. We scan
72
- # the working tree always, and history too when this is a git checkout.
73
- # --redact keeps secret values out of this terminal output.
74
- if gitleaks dir . --no-banner --redact --exit-code 1; then
75
- ok "no secrets in working tree"
76
- else
77
- bad "gitleaks found secrets in the working tree — rotate the credential now"
78
- fi
79
- if [ -d .git ] && git rev-parse --git-dir >/dev/null 2>&1; then
80
- if gitleaks git . --no-banner --redact --exit-code 1; then
81
- ok "no secrets in git history"
82
- else
83
- bad "gitleaks found secrets in git history — rotate, THEN scrub history"
84
- fi
85
- else
86
- warn "not a git repository; skipped history scan (working tree was scanned)"
87
- fi
88
- fi
89
-
90
- # ----------------------------------------------------------------------------
91
- # 2. SAST — semgrep
92
- # ----------------------------------------------------------------------------
93
- section "SAST (semgrep)"
94
- if need semgrep "pipx install semgrep / brew install semgrep"; then
95
- CFG=""
96
- if [ -f .semgrep.yml ]; then CFG="--config .semgrep.yml"
97
- elif [ -f .semgrep.yaml ]; then CFG="--config .semgrep.yaml"
98
- elif [ -f semgrep.yml ]; then CFG="--config semgrep.yml"
99
- elif [ -d .semgrep ]; then CFG="--config .semgrep"
100
- elif [ "${SECURE_CODING_SEMGREP_AUTO:-}" = "1" ]; then CFG="--config=auto"
101
- fi
102
-
103
- if [ -z "$CFG" ]; then
104
- warn "no semgrep config found and SECURE_CODING_SEMGREP_AUTO unset; skipping SAST"
105
- else
106
- # ERROR-severity findings gate the build. $CFG is intentionally unquoted so
107
- # it splits into separate args (it only ever holds tool flags we set above).
108
- if semgrep $CFG --error --severity ERROR --quiet; then
109
- ok "no semgrep ERROR findings"
110
- else
111
- bad "semgrep reported ERROR-severity findings"
112
- fi
113
- # WARNING-severity findings are informational only and must never abort
114
- # the script (set -e) nor flip FAILED.
115
- semgrep $CFG --severity WARNING --quiet || warn "semgrep WARNING findings present (informational)"
116
- fi
117
- fi
118
-
119
- # ----------------------------------------------------------------------------
120
- # 3. Per-stack dependency audit — detect by manifest, run ALL that match
121
- # ----------------------------------------------------------------------------
122
- section "Dependency audit"
123
-
124
- # --- Python ---------------------------------------------------------------
125
- if [ -f pyproject.toml ] || ls requirements*.txt >/dev/null 2>&1; then
126
- if have pip-audit; then
127
- if pip-audit; then ok "python deps: no known vulns (pip-audit)"
128
- else bad "python deps: vulnerabilities reported by pip-audit"; fi
129
- elif have uvx; then
130
- # `uv pip audit` is NOT a real subcommand; run pip-audit through uvx.
131
- if uvx pip-audit; then ok "python deps: no known vulns (uvx pip-audit)"
132
- else bad "python deps: vulnerabilities reported by uvx pip-audit"; fi
133
- else
134
- warn "pip-audit not installed (install: pipx install pip-audit, or use uvx pip-audit)"
135
- fi
136
- fi
137
-
138
- # --- Node / TypeScript ----------------------------------------------------
139
- if [ -f package.json ]; then
140
- if have osv-scanner; then
141
- LOCK=""
142
- if [ -f pnpm-lock.yaml ]; then LOCK="pnpm-lock.yaml"
143
- elif [ -f package-lock.json ]; then LOCK="package-lock.json"
144
- elif [ -f yarn.lock ]; then LOCK="yarn.lock"
145
- fi
146
- # OSV-Scanner v2 reorganized the CLI under `scan source` (`-L`/`--lockfile`
147
- # for a specific lockfile, `-r`/`--recursive` for a tree). The base `scan`
148
- # command stays backward-compatible across the v2 major.
149
- if [ -n "$LOCK" ]; then
150
- if osv-scanner scan source -L "$LOCK"; then ok "node deps: no known vulns (osv-scanner $LOCK)"
151
- else bad "node deps: vulnerabilities reported by osv-scanner"; fi
152
- else
153
- if osv-scanner scan source -r .; then ok "node deps: no known vulns (osv-scanner recursive)"
154
- else bad "node deps: vulnerabilities reported by osv-scanner"; fi
155
- fi
156
- elif [ -f pnpm-lock.yaml ] && have pnpm; then
157
- if pnpm audit --prod --audit-level high; then ok "node deps: no high+ vulns (pnpm audit)"
158
- else bad "node deps: high+ vulnerabilities reported by pnpm audit"; fi
159
- elif [ -f yarn.lock ] && have yarn; then
160
- # Yarn Berry (>=2) ships `yarn npm audit`; classic yarn lacks a severity
161
- # gate, so skip+warn rather than fail noisily.
162
- if yarn npm audit --severity high >/dev/null 2>&1; then
163
- if yarn npm audit --severity high; then ok "node deps: no high+ vulns (yarn npm audit)"
164
- else bad "node deps: high+ vulnerabilities reported by yarn npm audit"; fi
165
- else
166
- warn "yarn classic has no severity-gated audit; install osv-scanner instead"
167
- fi
168
- elif [ -f package-lock.json ] && have npm; then
169
- # `npm audit` REQUIRES a lockfile (it errors ENOLOCK without one) — that's
170
- # why this branch is gated on package-lock.json, not just package.json.
171
- if npm audit --omit=dev --audit-level=high; then ok "node deps: no high+ vulns (npm audit)"
172
- else bad "node deps: high+ vulnerabilities reported by npm audit"; fi
173
- elif [ ! -f package-lock.json ] && [ ! -f pnpm-lock.yaml ] && [ ! -f yarn.lock ]; then
174
- warn "package.json but no lockfile; commit a lockfile or install osv-scanner to audit node deps"
175
- else
176
- warn "no usable node auditor found (install osv-scanner, or use npm/pnpm/yarn with their lockfile)"
177
- fi
178
- fi
179
-
180
- # --- Go -------------------------------------------------------------------
181
- if [ -f go.mod ]; then
182
- if need govulncheck "go install golang.org/x/vuln/cmd/govulncheck@latest"; then
183
- # govulncheck reports only vulns your code actually CALLS (reachability).
184
- if govulncheck ./...; then ok "go deps: no reachable vulns (govulncheck)"
185
- else bad "go deps: reachable vulnerabilities reported by govulncheck"; fi
186
- fi
187
- fi
188
-
189
- # --- Dart / Flutter -------------------------------------------------------
190
- if [ -f pubspec.yaml ]; then
191
- # pub.dev has no CVE feed; `dart pub outdated` only flags stale versions.
192
- # This step is INFORMATIONAL and never sets FAILED.
193
- if need dart "https://dart.dev/get-dart"; then
194
- dart pub outdated || true
195
- info "dart deps: review outdated packages above (no CVE feed; advisory only)"
196
- fi
197
- fi
198
-
199
- # ----------------------------------------------------------------------------
200
- # 4. Summary
201
- # ----------------------------------------------------------------------------
202
- section "Summary"
203
- if [ "$FAILED" -eq 0 ]; then
204
- ok "no high/critical findings"
205
- else
206
- printf '%shigh/critical findings present — resolve before merge%s\n' "$RED" "$RST" >&2
207
- fi
208
- exit "$FAILED"
@@ -1,219 +0,0 @@
1
- ---
2
- name: security-scan
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
- tags: [security, sast, sca, secrets, scanning, owasp]
5
- recommends: [secure-coding, github-actions, verify]
6
- origin: risco
7
- ---
8
-
9
- # Security scan — orchestrate scanners, triage the noise, emit a gate
10
-
11
- A **machine-first** vulnerability sweep. Point automated scanners at a codebase,
12
- collect SARIF/JSON, then do the work that has actual value: dedupe cross-tool
13
- overlap, rank by exploitability, and emit one gate artifact CI can act on. The
14
- finding comes from a **tool run**, not a hunch — if you are reasoning about a
15
- design or hand-writing a fix, that is [`secure-coding`](../secure-coding/SKILL.md),
16
- not this skill.
17
-
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.
40
-
41
- | Repo contains | SAST | SCA | Secrets | Misconfig |
42
- |---|---|---|---|---|
43
- | Node (`package-lock.json`/`pnpm-lock.yaml`) | Semgrep | osv-scanner + `npm audit` (fast) | gitleaks → TruffleHog | Trivy |
44
- | Python (`poetry.lock`/`requirements.txt`) | Semgrep | osv-scanner + `pip-audit` (fast) | gitleaks → TruffleHog | Trivy |
45
- | Go (`go.mod`/`go.sum`) | Semgrep | osv-scanner (+ `govulncheck` for reachability) | gitleaks | Trivy |
46
- | Containers (`Dockerfile`, images) | — | Trivy `fs`/`image` | Trivy `--scanners secret` | Trivy `config` |
47
- | IaC (Terraform/k8s/Helm) | Semgrep (IaC rules) | — | gitleaks | Trivy `config`, Semgrep rulesets |
48
- | Monorepo (mixed) | Semgrep `auto` | osv-scanner (multi-ecosystem) | gitleaks → TruffleHog | Trivy |
49
-
50
- Full install (pinned), flag matrix, and suppression syntax: `references/tools.md`.
51
-
52
- ## Run recipes
53
-
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.
58
-
59
- ### SAST — Semgrep
60
-
61
- Free OSS edition (latest `1.164.0`, 2026-05-27): 30+ languages, ~2,000 community
62
- rules. SCA + Secrets rulesets are gated behind the hosted platform — use the
63
- dedicated tools below for those, not Semgrep.
64
-
65
- ```bash
66
- # Pin via the CLI version, not @latest. OWASP ruleset, SARIF out.
67
- semgrep scan --config p/owasp-top-ten --sarif --output sast.sarif .
68
- # Broader local sweep (community rules), no telemetry:
69
- semgrep scan --config auto --sarif --output sast.sarif --metrics off .
70
- ```
71
-
72
- ### SCA — osv-scanner (primary), native auditors (fast pass)
73
-
74
- osv-scanner (OpenSSF/Google) checks lockfiles against OSV.dev across ecosystems
75
- and catches **transitive** CVEs the native auditors miss. Run native first for
76
- speed, osv-scanner for coverage — never native alone.
77
-
78
- ```bash
79
- # Primary: lockfile-aware, multi-ecosystem, SARIF.
80
- osv-scanner scan source --format sarif --output sca.sarif .
81
- # Fast first pass (ecosystem-native, weaker on transitive):
82
- npm audit --omit=dev --audit-level=high --json > npm-audit.json # Node
83
- pip-audit --format json --output pip-audit.json # Python
84
- ```
85
-
86
- ### Secrets — gitleaks (tree + history), TruffleHog (verified)
87
-
88
- gitleaks (~150+ patterns, sub-second on diffs) is the pre-commit/CI workhorse.
89
- TruffleHog (800+ types) adds **live credential verification** — it auth-tests a
90
- hit to tell a real leaked key from a sample. Scan **history, not just the tree**:
91
- a key deleted in HEAD is still in the pack files and still rotatable.
92
-
93
- ```bash
94
- # gitleaks: redacted SARIF over the working tree AND full git history.
95
- gitleaks detect --redact --report-format sarif --report-path secrets.sarif
96
- # TruffleHog: only verified (live) secrets across history.
97
- trufflehog git file://. --only-verified --json > trufflehog.json
98
- ```
99
-
100
- ### Misconfig / IaC — Trivy (PINNED — see the caveat above)
101
-
102
- Trivy scans filesystems, images, and IaC and finds transitive CVEs `npm audit`
103
- misses.
104
-
105
- ```bash
106
- # Pin the EXACT version (NOT v0.69.4/.5/.6 — those were the malicious releases).
107
- # Verify the checksum/cosign signature before first use. See references/tools.md.
108
- trivy fs --scanners vuln,secret,misconfig --format sarif --output trivy.sarif .
109
- ```
110
-
111
- ## Triage — turn noise into a ranked report
112
-
113
- The deliverable is not the four SARIF files. It is a deduped, ranked report.
114
-
115
- 1. **Merge + dedupe.** Cross-tool overlap is real (osv-scanner and Trivy both
116
- flag the same CVE; gitleaks and TruffleHog both flag the same key). Key on
117
- `(class, normalized-id, path, line)` and keep the richest record — prefer the
118
- one with verification (TruffleHog) or reachability (govulncheck).
119
- 2. **Normalize severity.** SARIF `level` and tool-native severities disagree;
120
- map them all to one `critical/high/medium/low` scale (`references/triage.md`).
121
- 3. **Rank by exploitability, not by count.** A finding scores higher when it is
122
- **reachable** (called, not just present) **+ exposed** (on an untrusted path)
123
- **+ a sensitive sink** (auth, money, PII, RCE). A verified live secret or a
124
- reachable RCE CVE outranks a theoretical lib finding behind a feature flag.
125
- 4. **Suppress with a written justification, never a blanket ignore.** Each
126
- suppression records *who, why, and an expiry* — not a silent `.semgrepignore`
127
- that hides the next real bug too.
128
-
129
- ```text
130
- BAD — dump 412 raw findings from four tools, sorted alphabetically, no ranking.
131
- GOOD — 3 unsuppressed criticals first:
132
- 1. [secrets] VERIFIED live Stripe sk_live_… in config/.env (history) → ROTATE NOW
133
- 2. [sca] CVE-2024-… lodash 4.17.20 transitive, reachable in src/api/parse.ts → bump 4.17.21
134
- 3. [sast] SQL built from req.query in routes/search.js:48 → parameterize
135
- + 7 mediums summarized, + 18 suppressed (each with justification + expiry).
136
- ```
137
-
138
- Full ranking rubric, dedupe keying, and severity-normalization map:
139
- `references/triage.md`.
140
-
141
- ## The gate artifact
142
-
143
- Emit one `security-scan-report.json` — the machine-checkable contract CI gates on.
144
-
145
- ```json
146
- {
147
- "schemaVersion": "1.0",
148
- "scannedAt": "2026-06-02T10:00:00Z",
149
- "target": ".",
150
- "tools": [{ "name": "osv-scanner", "version": "2.0.2" }],
151
- "summary": { "critical": 1, "high": 2, "medium": 7, "low": 14, "suppressed": 18 },
152
- "findings": [
153
- {
154
- "class": "sca",
155
- "ruleId": "CVE-2024-XXXXX",
156
- "path": "package-lock.json",
157
- "line": 0,
158
- "severity": "critical",
159
- "status": "open",
160
- "tool": "osv-scanner",
161
- "exploitability": "reachable",
162
- "title": "Prototype pollution in lodash <4.17.21"
163
- }
164
- ]
165
- }
166
- ```
167
-
168
- - `status` is one of `open | suppressed | fixed`; `severity` one of
169
- `critical | high | medium | low`. Schema in full: `references/triage.md`.
170
- - **Gate rule:** any `open` finding at `critical` (and, on a strict gate, `high`)
171
- → fail. `suppressed` never fails. `scripts/verify.sh` enforces exactly this and
172
- exits `0` on a clean/empty report (no false failure).
173
-
174
- ## CI wiring (brief)
175
-
176
- - Pin actions to a **full commit SHA**, not a tag, never `@latest` — the hijacked
177
- `aquasecurity/trivy-action` was pulled by tag.
178
-
179
- ```yaml
180
- # .github/workflows/security-scan.yml — pin the SHA, verify before bumping.
181
- - uses: aquasecurity/trivy-action@<full-40-char-sha> # NEVER @latest / @master
182
- with: { scan-type: fs, format: sarif, output: trivy.sarif }
183
- - run: ./scripts/verify.sh # gate on security-scan-report.json
184
- ```
185
-
186
- - Upload SARIF to code scanning; gate the merge on `verify.sh`, not on a human
187
- reading logs. See [`github-actions`](../github-actions/SKILL.md) for the
188
- pipeline shell and [`verify`](../verify/SKILL.md) for the broader green gate
189
- this feeds.
190
-
191
- ## Anti-patterns
192
-
193
- | Anti-pattern | Do instead |
194
- |---|---|
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. |
204
-
205
- ## Project grounding (02-DOCS + CLAUDE.md)
206
-
207
- In a project with a `02-DOCS/` layer (the [`harness`](../harness/SKILL.md)
208
- Karpathy wiki), record the scanner choices, pinned versions, gate thresholds, and
209
- any accepted-risk suppressions in `02-DOCS/wiki/stack/security-scan.md`, and index
210
- it in `02-DOCS/wiki/index.md` (the Knowledge map; root `CLAUDE.md` keeps only a short
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.
214
-
215
- ## See Also
216
-
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.
@@ -1,14 +0,0 @@
1
- # Evals — security-scan
2
-
3
- `cases.yaml` holds two kinds of checks, run by the skill eval harness — no live
4
- scanners are invoked. `should_trigger` / `should_not_trigger` are routing cases:
5
- each prompt asserts whether this skill should fire, and every negative names the
6
- real sibling it belongs to (`secure-coding`, `code-review`, `review`, `verify`).
7
- The `capability` case is a rubric: given the monorepo scenario, the agent's plan
8
- is graded against the `must_include` list (correct tool per ecosystem, history
9
- secret scan, SARIF merge + dedupe, exploitability ranking, the
10
- `security-scan-report.json` artifact, scanner pinning, rotate-then-scrub, and
11
- read-only default). Score the routing cases as pass/fail on the trigger decision
12
- and the capability case by how many rubric items the plan covers. The
13
- `scripts/verify.sh` gate is exercised separately by pointing it at a sample
14
- `security-scan-report.json`.
@@ -1,50 +0,0 @@
1
- skill: security-scan
2
-
3
- should_trigger:
4
- - prompt: "Scan this repo for vulnerabilities before we ship."
5
- why: Core multi-class sweep (SAST + SCA + secrets) — the central use case.
6
- - prompt: "Check my package-lock.json for known CVEs."
7
- why: SCA over a lockfile; osv-scanner primary with npm audit as the fast pass.
8
- - prompt: "Did anyone commit AWS keys? Scan the git history."
9
- why: Non-obvious — secrets in history, not just the working tree; a deleted key is still leaked.
10
- - prompt: "escanea el repo en busca de vulnerabilidades y secretos"
11
- why: Spanish trigger for the full vuln + secrets sweep.
12
- - prompt: "Set up Semgrep and gitleaks to fail CI on critical findings."
13
- why: CI gate artifact — emit security-scan-report.json and wire verify.sh into the pipeline.
14
- - prompt: "Is it safe to use aquasecurity/trivy-action@latest in my pipeline?"
15
- why: Non-obvious — the scanner is itself a supply-chain risk (March 2026 Trivy compromise); pin SHA, verify provenance.
16
- - prompt: "analitza les dependències del projecte per CVEs"
17
- why: Catalan trigger for dependency CVE auditing.
18
-
19
- should_not_trigger:
20
- - prompt: "Threat-model this new payments endpoint."
21
- route_to: secure-coding
22
- why: Design reasoning (STRIDE on a feature), no tool run — the answer comes from a human reasoning about the design.
23
- - prompt: "Write the fix for this SQL injection."
24
- route_to: secure-coding
25
- why: Authoring a vulnerable→fixed diff; this skill reports findings, it does not write fixes.
26
- - prompt: "Review my PR diff for correctness and quality."
27
- route_to: code-review
28
- why: General correctness/quality review of a diff, not a scanner-driven vuln sweep.
29
- - prompt: "Be my adversarial reviewer for this change against the spec."
30
- route_to: review
31
- why: SDD adversarial review gate against a spec, not automated scanning.
32
- - prompt: "Run lint and tests and tell me if the green gate passes."
33
- route_to: verify
34
- why: The lint/type/test verify phase; security-scan can feed it but is not it.
35
-
36
- capability:
37
- - scenario: >
38
- A Node + Python monorepo with a committed .env, a transitive lodash CVE
39
- reachable from src/api, and a hardcoded Stripe sk_live key in config. Run a
40
- security scan and produce the gate artifact.
41
- must_include:
42
- - Selects the correct tool per ecosystem (Semgrep SAST; osv-scanner SCA with npm audit / pip-audit as fast pass; gitleaks + TruffleHog secrets; Trivy misconfig)
43
- - Scans git history for secrets, not just the working tree
44
- - Emits SARIF/JSON per tool and merges into one report
45
- - Dedupes cross-tool overlap (same CVE / same secret flagged twice)
46
- - Ranks by exploitability (reachable + exposed + sensitive sink), criticals first
47
- - Produces security-scan-report.json conforming to the documented schema
48
- - Pins scanner versions and flags the Trivy supply-chain caveat (no @latest action)
49
- - Recommends rotating the verified Stripe key first, then scrubbing history
50
- - Does NOT auto-fix or mutate the tree without asking (read-only by default)
@@ -1,97 +0,0 @@
1
- # Tools — pinned installs, flags, suppression syntax
2
-
3
- Facts accessed 2026-06-02. Pin the exact versions shown; treat the scanner as a
4
- supply-chain dependency, not a throwaway CLI.
5
-
6
- ## Semgrep (SAST)
7
-
8
- - Latest OSS `1.164.0` (2026-05-27). Community/OSS edition: 30+ languages, ~2,000
9
- community rules. **SCA + Secrets rulesets are gated behind the hosted AppSec
10
- platform** (login required) — do not rely on Semgrep for those; use osv-scanner
11
- and gitleaks/TruffleHog instead.
12
-
13
- ```bash
14
- pip install semgrep==1.164.0 # or pipx install semgrep==1.164.0
15
- semgrep scan --config p/owasp-top-ten --sarif --output sast.sarif --metrics off .
16
- semgrep scan --config auto --sarif --output sast.sarif --metrics off .
17
- ```
18
-
19
- - Severity: gate on `ERROR`; treat `WARNING`/`INFO` as informational.
20
- - Suppression: inline `// nosemgrep: rule-id` on the line, or a `.semgrepignore`
21
- for **paths** (`vendor/`, `test/fixtures/`) — never a blanket rule mute.
22
-
23
- ## osv-scanner (SCA — primary)
24
-
25
- - OpenSSF/Google. Checks lockfiles against OSV.dev across ecosystems; ships
26
- guided remediation. v2 CLI: `osv-scanner scan source`.
27
-
28
- ```bash
29
- # Install a pinned release binary from github.com/google/osv-scanner/releases.
30
- osv-scanner scan source --format sarif --output sca.sarif .
31
- osv-scanner scan source -L package-lock.json --format sarif --output sca.sarif
32
- ```
33
-
34
- - Suppression: `osv-scanner.toml` with an `[[IgnoredVulns]]` block per CVE,
35
- including `reason` and `ignoreUntil` (expiry).
36
-
37
- ## Native auditors (SCA — fast pass)
38
-
39
- Weaker on transitive CVEs; a first pass, never the only pass.
40
-
41
- ```bash
42
- npm audit --omit=dev --audit-level=high --json > npm-audit.json # Node
43
- pip-audit --format json --output pip-audit.json # Python (PyPA + Trail of Bits; OSV + PyPI feed)
44
- govulncheck ./... # Go — reachability-aware
45
- ```
46
-
47
- ## gitleaks (Secrets — speed)
48
-
49
- - ~150+ default regex patterns, sub-second on diffs. Ideal pre-commit + CI diff.
50
-
51
- ```bash
52
- # Pin a release from github.com/gitleaks/gitleaks/releases.
53
- gitleaks detect --redact --report-format sarif --report-path secrets.sarif # tree + full history
54
- gitleaks protect --staged --redact # pre-commit (diff only)
55
- ```
56
-
57
- - Suppression: `.gitleaks.toml` `[allowlist]` (regexes/paths/commits) or an inline
58
- `# gitleaks:allow` comment on the offending line.
59
-
60
- ## TruffleHog (Secrets — depth + verification)
61
-
62
- - 800+ secret types. **Credential verification:** live-tests a detected secret via
63
- auth, so a hit is a *confirmed* live leak, not a guess. Scans git history, S3,
64
- Docker, etc.
65
-
66
- ```bash
67
- trufflehog git file://. --only-verified --json > trufflehog.json
68
- ```
69
-
70
- - Pattern most teams use: **gitleaks pre-commit** (speed) + **TruffleHog in CI**
71
- (depth + verification).
72
-
73
- ## Trivy (Misconfig / IaC / containers) — PINNED, VERIFIED
74
-
75
- - Aqua Security, scans containers/filesystems/IaC/language deps, generates SBOM,
76
- catches transitive CVEs `npm audit` misses.
77
- - **Supply-chain caveat (March 2026):** malicious releases `v0.69.4`, `v0.69.5`,
78
- `v0.69.6` and a hijacked `aquasecurity/trivy-action` GitHub Action stole CI
79
- secrets. **Pin an exact known-good version, verify the cosign signature /
80
- checksum before first use, and pin the Action to a full commit SHA — never a
81
- tag, never `@latest`.**
82
-
83
- ```bash
84
- # Install a pinned, signature-verified release (NOT 0.69.4/.5/.6).
85
- trivy fs --scanners vuln,secret,misconfig --format sarif --output trivy.sarif .
86
- trivy config --format sarif --output trivy-iac.sarif ./infra
87
- trivy image --format sarif --output trivy-img.sarif <pinned-image@sha256:...>
88
- ```
89
-
90
- - Suppression: `.trivyignore` (one CVE/check id per line) or inline
91
- `#trivy:ignore:<id>` in IaC files. Record a reason in review, not just the id.
92
-
93
- ## SARIF notes
94
-
95
- - Every recipe emits SARIF 2.1.0 so findings merge into one report. Where a tool
96
- only emits native JSON (`npm audit`, `pip-audit`, TruffleHog), normalize it to
97
- the report schema in `triage.md` rather than gating on its raw shape.