feat(guardrails): secure-by-default rule and /guardrails scanner

Always-on rules/secure-by-default.md: hosting, a11y, Supabase RLS,
SMS/email consent, cloud functions, API hygiene incl. password storage.
Stdlib scanner (FAIL/WARN/MANUAL) + skill, 89-check suite, auditor
gate wiring, profiles, routing row (plus Explore rows confirmed
through the router dialog).
This commit is contained in:
bchanot committed 2026-10-18 18:10:20 +02:00
1 parent c5fad5ee8f
commit 558c49e1a1
45 files changed
+2473 -5

No files matched your search

+1
View File
@@ -24,6 +24,7 @@ Gather context. Produce complete PROJECT BRIEF as single source of truth.
| "I don't know / you decide" | Propose ONE concrete default + why, ask yes/no | Take the default, mark `(assumed)`, list in OPEN DECISIONS |
| Contradictory answers (e.g. embedded runtime + managed cloud DB) | Name the contradiction, ask which side wins | Put BOTH options in OPEN DECISIONS; do not silently pick one |
| Language not stated (new project / from scratch / whole-project rewrite) | Propose Rust + why (`rules/default-language.md`); name the contraindication if another language fits better (browser frontend, mandated platform, missing ecosystem) | Rust, marked `(assumed)`, listed in OPEN DECISIONS |
| Project has an API, a database, messaging, cloud functions or a UI | Apply `rules/secure-by-default.md`: note under QUALITY which of the five guardrail domains apply, and list each dashboard-only item (spend cap, WAF, budget alert) in OPEN DECISIONS as manual | A domain applies and nothing is planned: list it in OPEN DECISIONS, never drop it silently |
| Partial answer to the block | Re-ask ONLY the missing items in the follow-up round | Missing fields → `none stated` + OPEN DECISIONS entry |
| Feature list balloons (>10) | Keep the 10 the user ranks first as V1 | Overflow goes to OUT OF SCOPE with a `(deferred by budget)` tag |
+9 -2
View File
@@ -13,8 +13,8 @@ classify by severity, and render a verdict. You never fix code, you never
edit anything but the report file (audit mode only), and you never trust a
prior run — every scan is fresh and complete.
Bash runs semgrep and read-only inspection only — never a command that
mutates code, installs, or commits.
Bash runs semgrep, the guardrails scanner and read-only inspection only —
never a command that mutates code, installs, or commits.
Tracing what a destructive tool would do (a mirror, a sync with delete, a
recursive rm, a deploy script) is done by reading it, never by running it,
not even against a scratch tree. A brief that says otherwise is wrong:
@@ -99,6 +99,13 @@ Each hit → severity + file:line + one-line why:
- stack trace / internal path / DB error surfaced to the user (→ MEDIUM)
- secret / password / token / PII written to a log (→ HIGH)
- tracked `.env` or committed credential file (→ CRITICAL)
- guardrails scanner, when `$HOME/.claude/skills/guardrails/scripts/scan.py`
exists: `python3 -B <scan.py> <project root> --domain api,supabase`.
`FAIL` → HIGH, except `API-SECRET-LITERAL`, `API-PASSWORD-PLAINTEXT`,
`SB-SERVICE-ROLE-CLIENT` and `SB-SERVICE-ROLE-LITERAL` → CRITICAL.
`WARN` → MEDIUM. `MANUAL` is not reported here. In gate mode keep only
findings in files of the diff.
Scanner absent → say so on the checklist line, never a silent skip.
If `CONTEXT` (archetype) is given, scope the checklist to what applies
(no web-XSS checks on firmware, etc.).