API Security Checklist

Checklist

  1. HTTPS only; set Strict-Transport-Security at the proxy.
  2. Hash passwords (Argon2/bcrypt); never log passwords or tokens.
  3. Validate all input with Pydantic models and constraints.
  4. Use parameterised queries / an ORM (no SQL string building).
  5. Restrict CORS to known origins.
  6. Rate-limit login and expensive endpoints (e.g. slowapi or an API gateway).
  7. Return generic error messages for auth failures; do not reveal which part was wrong.
  8. Check permissions on every resource (user can only see their own orders).