Authentication, RBAC, and Hardening standards.
@nestjs/passport with passport-jwt.algorithms: ['RS256'] (preferred) or ['HS256']. Reject none.iss (Issuer) and aud (Audience).AuthGuard globally (APP_GUARD).@Public() decorator and allow access if present in the Guard.Reflector.createDecorator<string[]>().Reflector to merge Method/Class roles (getAllAndOverride).argon2) instead of Bcrypt (vulnerable to GPU/FPGA cracking).await argon2.hash(password).crypto.createCipheriv.csurf via @nest-middlewares/csurf or similar wrapper.Authorization: Bearer headers (localStorage), CSRF is less critical but SameSite: Strict cookies are still recommended for defense-in-depth.app.use(helmet()).Strict-Transport-Security with preload.helmet.permissionsPolicy().*.@nestjs/throttler with Redis storage (throttler-storage-redis) to sync limits across instances.AuditInterceptor that logs POST/PUT/DELETE actions to a secure, immutable log store (separate from app logs).npm audit or pnpm audit --prod in pipelines..env files in production runtime. Inject secrets via environment variables from a vault (AWS Secret Manager / HashiCorp Vault) into the container environment.ClassSerializerInterceptor + @Exclude() globally or per-controller to strip sensitive fields (passwords) from responses.ValidationPipe({ whitelist: true }) prevents mass assignment attacks by stripping unknown properties from payloads./api, /docs) in production.HttpService).169.254.169.254) via infrastructure/firewall.query()) with string concatenation. Use parameterized queries if raw SQL is strictly necessary.dompurify) before storage or output.