1---2name: security3description: Security — Index4---56# Security — Index78Persimmon security = NextAuth v5 (credentials/OAuth) with a Prisma adapter and JWT sessions, plus a dedicated security review pass before delivery. This mother is a map; follow the child for the actual work.910## Trigger1112- "Add auth / login" / "NextAuth" / "sessions" / "protect this route"13- "Security review" / "audit before delivery" / "check headers / CSP"1415## The child skills1617| Skill | When to use | Owns |18|---|---|---|19| `security-nextauth` | Implementing or fixing auth | NextAuth v5 credentials + Prisma adapter, JWT sessions, `trustHost: true`, middleware reading `x-forwarded-host`, route protection |20| `security-review` | Pre-delivery audit (also part of `quality`) | Headers, auth gaps, injection, secret exposure, CSP, dependency CVEs |2122## How to route23241. **Auth work?** → `security-nextauth`.252. **Auditing?** → `security-review` (invoked standalone or via `quality-final-review`).2627## Persimmon security defaults — one-screen summary2829- **NextAuth v5 behind Railway**: `trustHost: true` is mandatory; middleware redirects must read `x-forwarded-host` or users bounce to `*.up.railway.app`.30- **Secrets server-side only** — never `NEXT_PUBLIC_*`, never in client bundles.31- **Headers** in `next.config.ts`: HSTS, `X-Frame-Options: DENY`, `X-Content-Type-Options: nosniff`, `Referrer-Policy: strict-origin-when-cross-origin`.32- **Validate every boundary input** with Zod (see `stack-zod-boundary`).33- **Never log** secrets, PII, or document contents — redact in error reports.3435## Anti-patterns banned3637- NextAuth without `trustHost` behind a proxy38- Redirects using the internal host instead of `x-forwarded-host`39- Secrets in `NEXT_PUBLIC_*`40- Logging PII / document contents41- Missing security headers in `next.config.ts`4243## Relationship to other mothers4445| Mother | Connection |46|---|---|47| `stack` | Boundary validation via `stack-zod-boundary` |48| `quality` | `security-review` is one dimension of `quality-final-review` |49| `infra` | Header config ships in the deployed app (`infra-railway-deploy`) |