2.2.8 Security & Best Practices
1. Authentication
• JWT tokens with short-lived expirations.
• Role-based authorization for admin/trader routes.
2. Input Validation
• express-validator or Joi for request body queries (protect against SQL injection, XSS).
3. Rate Limiting
• express-rate-limit on critical endpoints (login, trades) to prevent brute force or spam.
4. HTTPS/TLS
• Encrypt all requests. Terminate TLS at load balancer or reverse proxy.
5. Secrets Management
• Store database/password secrets in AWS Secrets Manager or environment variables secured in CI/CD pipelines.
6. Logging & Auditing
• Use Winston/Pino for structured logs.
• Maintain an audit trail for important actions (trade execution, user role changes).
Last updated