|
|
@@ -1,6 +1,6 @@
|
|
|
---
|
|
|
description: Security vulnerability scan with a reviewable remediation patch — OWASP, CWE, CVE, secrets, injection
|
|
|
-argument-hint: <system-dir>
|
|
|
+argument-hint: <system-dir> [--show-secrets]
|
|
|
---
|
|
|
|
|
|
Run a **security hardening pass** on `legacy/$1`: find vulnerabilities, rank
|
|
|
@@ -9,6 +9,25 @@ them, and produce a reviewable patch for the critical ones.
|
|
|
This command never edits `legacy/` — it writes findings and a proposed patch
|
|
|
to `analysis/$1/`. The user reviews and applies (or not).
|
|
|
|
|
|
+## Step 0 — Secrets quarantine setup
|
|
|
+
|
|
|
+Findings files get shared, committed, and pasted into decks — discovered
|
|
|
+credential values must never land in them. Before any scanning:
|
|
|
+
|
|
|
+1. Ensure `analysis/.gitignore` exists and contains the line
|
|
|
+ `SECRETS.local.md`. Create the file or append the line if missing.
|
|
|
+2. If the project is a git repo, verify with
|
|
|
+ `git check-ignore -q analysis/$1/SECRETS.local.md` — if that exits
|
|
|
+ non-zero, fix the ignore rule before proceeding. Do not write any
|
|
|
+ findings until this check passes (skip the check only if there is no
|
|
|
+ git repo).
|
|
|
+
|
|
|
+All secret values in every artifact this command produces are **masked**
|
|
|
+(`AKIA****`, `password=****`) and cited by `file:line`. The one exception:
|
|
|
+if the user passed `--show-secrets`, raw values may appear in
|
|
|
+`analysis/$1/SECRETS.local.md` (gitignored above) and nowhere else —
|
|
|
+never in SECURITY_FINDINGS.md or the patch commentary.
|
|
|
+
|
|
|
## Scan
|
|
|
|
|
|
Spawn the **security-auditor** subagent:
|
|
|
@@ -20,7 +39,9 @@ hardcoded secrets, vulnerable dependency versions, missing input validation,
|
|
|
path traversal. For each finding return: CWE ID, severity
|
|
|
(Critical/High/Med/Low), file:line, one-sentence exploit scenario, and
|
|
|
recommended fix. Run any available SAST tooling (npm audit, pip-audit,
|
|
|
-OWASP dependency-check) and include its raw output."
|
|
|
+OWASP dependency-check) and include its raw output. Mask every discovered
|
|
|
+credential value per your secret-handling rules — file:line plus a 2–4
|
|
|
+character masked preview, never the value itself."
|
|
|
|
|
|
## Triage
|
|
|
|
|
|
@@ -29,6 +50,15 @@ Write `analysis/$1/SECURITY_FINDINGS.md`:
|
|
|
- Findings table sorted by severity
|
|
|
- Dependency CVE table (package, installed version, CVE, fixed version)
|
|
|
|
|
|
+If any hardcoded credentials were found, also write
|
|
|
+`analysis/$1/SECRETS.local.md` (the gitignored quarantine file from Step 0):
|
|
|
+one row per credential — masked preview, `file:line`, credential type, what
|
|
|
+it appears to grant access to, production/test guess, and a rotation
|
|
|
+recommendation. With `--show-secrets`, append the raw value column here —
|
|
|
+this file only. SECURITY_FINDINGS.md gets a one-line pointer:
|
|
|
+"N hardcoded credentials found — inventory in SECRETS.local.md (gitignored;
|
|
|
+not for sharing)."
|
|
|
+
|
|
|
## Remediate
|
|
|
|
|
|
For each **Critical** and **High** finding, draft a minimal, targeted fix.
|