feat(security): security controls — rate limits, headers, ZK canary, fuzz scaffold, KAT manifest (task 1.10 slice B/C) #70
No reviewers
Labels
No labels
epic
phase-0
phase-1
phase-2
phase-3
phase-4
phase-5
phase-6
phase-7
phase-8
phase-9
priority/P0
priority/P1
priority/P2
type/backend
type/client
type/docs
type/ops
type/security
type/spike
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
primatekuntech/failsulit!70
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/1.10-security-controls"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #25 — completes task 1.10 on top of #69 (authz matrix, SEC-03/04). Together the two PRs fulfill the Phase 1 exit gate: matrix 100% coverage incl. enforced H-1 dimensions, headers asserted, abuse paths rate-limited.
SEC-09 — security headers: SecurityHeadersMiddleware on every response (nosniff, X-Frame-Options DENY, Referrer-Policy strict-origin-when-cross-origin, CSP
frame-ancestors 'none', COOP same-origin); HSTS only over forwarded-HTTPS. Full SPA CSP + COEP land with the web client (WEB-03/04, Phase 5). CI asserts headers on 200s AND 401s.SEC-08/M-5 — tiered rate limiting: three new account-keyed partitions —
email-velocity(invitation sends to arbitrary addresses, 10/h),wrap-fetch(KEY-13, 30/min),recovery-initiate(KEY-17, 5/h) — alongside the existing IP/DID partitions. Every rejection: 429 + Retry-After + asecurity.ratelimitedaudit row (Category=security, partition + path) via the rate limiter's OnRejected — brute-force campaigns are now visible in the admin audit log, best-effort so a tripped limiter can never 500.Audit category:
AuditLog.Categorycolumn (+ migration), surfaced in the admin audit-log endpoint with a?category=filter and in each row's payload.SEC-06 — ZK canary scan: key-material canary planted in a wrap upload; asserted absent from audit/activity/notification/user stores. Plaintext name canaries deliberately excluded as FIL-09 debt (documented in the class doc — never falsely red).
SEC-11 — fuzz scaffold: malformed JSON + hostile queries across 12 public protocol surfaces must yield 4xx/410, never 5xx. First-run findings, fixed here: POST /api/auth/ssdid/authenticate and POST /api/invitations/token/{token}/accept-with-wallet returned 500 on absent credential — now 400.
security-nightly.ymlruns the extended harness nightly.SEC-05 — KAT/tamper manifest: one consolidated harness across all four enabled families (Ed25519/Ecdsa/MlDsa/KazSign): roundtrip + bit-flip tamper must fail closed.
Suite 837/0/39 Release ×3; coverage gate 84.50% ≥ 80. H-1 dimensions whose enforcement arrives with Phases 2/5/7 (view-only share, download kill-switch, web-disabled, step-up) remain declared-in-matrix (see #69).