Skip to Content
Build an appSecurity basics

Security basics

What this layer solves

Security is not an audit checkbox on day one — it’s least privilege, secrets hygiene, and not trusting user input. Get the basics wrong and AI-generated code can leak keys or expose data.

Topics and defaults

TopicWhat to internalizeNK Wiki default posture
SecretsAPI keys only in env vars / secret manager; never in Git.env.local, Vercel env dashboard
AuthSessions/JWT; who can call which APISupabase Auth + RLS
Input validationTreat all client data as hostileZod or similar at API boundary
Dependenciesnpm audit, pin versions for prodRegular updates, not blind latest
HTTPSAlways in productionLet Vercel handle certs

Outline: checklist before “real users”

  1. Rotate any key that ever hit a log or screenshot.
  2. RLS / authorization rules match your product rules — not “public read/write for dev convenience.”
  3. CORS and cookie settings intentional — not copy-pasted wildcards.
  4. Rate limiting on auth and expensive endpoints when you expose APIs.

Last reviewed: April 2026.

Last updated on