838 B
838 B
Security, Auth, Headers, Validation, Rate‑Limiting, Secrets
Authentication & RBAC
- NextAuth (Auth.js) mandatory
- Sessions: pick JWT or DB, document choice
- Route/Server Action guards via middleware; role model documented
Security Headers
- CSP (nonce/hash) +
Referrer-Policy: strict-origin-when-cross-origin X-Frame-Options: DENY;Permissions-Policyscoped- COOP/COEP where SharedArrayBuffer needed
- Cookies: HttpOnly, Secure, SameSite=Strict
Validation
- Zod everywhere (server actions, routes, forms)
react-hook-form+ zod resolver
Rate Limiting
- Redis (Upstash/self-hosted)
- Enforce on auth, forms, APIs (middleware/handlers)
Secrets Policy
.env.exampleis canonical list; validate at boot (lib/env.tswith Zod)- Use SOPS/Age, 1Password, or Docker secrets; never commit secrets