Why this matters
Hardening and auditing align with SOC 2 security criteria.
Add middleware to set HSTS, X-Content-Type-Options, and secure cookies; log JSON with actor and trace_id for auth and admin routes.
Hardening and auditing align with SOC 2 security criteria.
Side-by-side examples engineers can pattern-match during review.
handler = (req) => Response.ok('ok');final handler = const Pipeline().addMiddleware(securityHeaders()).addMiddleware(auditLogs()).addHandler(app);response.change(headers:{'Strict-Transport-Security':'max-age=31536000'})response.change(headers:{})From the same buckets as this rule.
Public services must require TLSv1.2 or higher and set HSTS (max-age ≥ 15552000, includeSubDomains). Reject plaintext HTTP and weak ciphers; cookies must be Secure and HttpOnly with SameSite set.