What you get for free
- CSRF protection — Origin header validation + per-build encrypted action IDs.
- Dead-code elimination — unused Server Actions don't end up in the build.
- POST-only — no GET-by-URL exposure.
- Encrypted closures — values captured by an inline action are encrypted before the action reference reaches the client.
What you must add yourself
| Risk | Mitigation |
|---|---|
| Untrusted input | Validate every field server-side (Zod or equivalent) |
| Wrong user mutating someone else's data | Read session, check resource ownership before writing |
| Rate abuse | Rate-limit per IP/user (Upstash, Redis, edge middleware) |
| Sensitive secrets in closures | Avoid capturing secrets directly; pass identifiers and re-fetch on the server |