Security suites from the 2026-12 audit: static rules, attack probes, per-class tests, gate

- doctor: code-patterns (unescaped HTML/JSON-LD, eval, shell, NEXT_PUBLIC_ secrets,
  overrideAccess / Local API user, where from the request, redirects and fetches to a
  request address) and config-dangerous; live-probes runs the safe attack probes on --url
- ATTACK_PROBES / runAttackProbes / createProbeContext exported from /doctor; the reference
  site runs all of them in pnpm e2e:built (both bundlers) plus CSRF and cookie flags;
  project template iapl-audit/resources/attack-probes.spec.template.ts
- test/securityPatterns.test.ts gates every hit against test/security-patterns.allow.json;
  test/securityClasses.test.ts covers XSS, redirects, pollution, logs, DoS, cache poisoning
- pnpm security:gate (pnpm audit --prod, the two suites, optional offline ZAP) in prepublishOnly
- audit findings F1, F3, F4, F5 reproduced as expected-to-fail tests/probes; no fix built
- docs: security.md threat list + Security suites, doctor.md, AGENT.md, CHANGELOG, skills

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-12-01 16:46:42 +01:00
co-authored by Claude Opus 5.5
parent a416411f01
commit d2f19095dc
25 changed files with 1400 additions and 5 deletions
+3
View File
@@ -1462,6 +1462,9 @@ its own tests). Order from the cheapest:
| Site in the browser | `iapl-seo-check`, `iapl-consent-check`, `cookie-scan` | before handover, after deploy |
| Closed doors (Playwright) | `iapl-audit/resources/closed-doors.spec.template.ts` → `tests/closed-doors.spec.ts`: every door that must stay closed, asked on a production build as anonymous, customer and editor; add the project's own doors (security.md "Closed doors from outside") | before every release and after every IAPL / Payload update |
| Routes judged | `iapl-audit/resources/routes.template.ts` → `tests/routes.ts`; `pnpm payload run tests/routes.ts` against the committed `tests/routes.snapshot.json`, one reason per route; `… update` after an upgrade (security.md "Routes nobody has judged") | in CI, and after every IAPL / Payload / plugin update |
| Security, code | `pnpm exec iapl-doctor --only security`: headers, CSP, 2FA, account rules and the static rules over your code (`code-patterns`: unescaped HTML / JSON-LD, `overrideAccess: true` or a Local API `user` without `overrideAccess: false` where a request reaches, a `where` from the request, `eval`, `NEXT_PUBLIC_` secrets, redirects and fetches to an address from the request; `config-dangerous`). A correct place: `// iapl-security-ok: <why>` (security.md "Security suites") | before every "done", in CI |
| Attack probes (Playwright / doctor) | `iapl-audit/resources/attack-probes.spec.template.ts` → `tests/attack-probes.spec.ts` on a production build or staging (secret files, bundle secrets, proxy bypass, open redirect, cache poisoning, NoSQL operators, anonymous where / draft / GraphQL reads, error leaks, unbounded lists, `/_next/image`, 8 MB bodies); add a probe per custom endpoint in `EXTRA`. On the live site: `pnpm exec iapl-doctor --url https://<domain> --only live-probes` (changes nothing) | before every release, after every IAPL / Payload / Next update, and after deploy (live) |
| Dependencies | `pnpm audit --prod` (the doctor's `deps-audit`): no high or critical; see §4 for the minimum Next / sharp / Payload | before every deploy |
| Project logic | vitest for your own functions (mapping company data to JSON-LD, helpers, hooks, migration scripts with `--dry-run`) | when you write logic the plugin does not have |
| Panel | the editor test (§11) and the empty-block test (§6.5a) | every new block / global |