pub async fn security_headers_middleware(
__arg0: State<SecurityState>,
request: Request,
next: Next,
) -> ResponseExpand description
Security headers middleware
Adds security-related HTTP headers to all responses:
- HSTS (Strict-Transport-Security)
- X-Frame-Options
- X-Content-Type-Options
- X-XSS-Protection
- Content-Security-Policy
- CORS headers
ยงPhase 5C: Security Hardening
This middleware provides defense-in-depth by:
- Preventing clickjacking (X-Frame-Options)
- Preventing MIME sniffing (X-Content-Type-Options)
- Enforcing HTTPS (HSTS)
- Preventing XSS (CSP, X-XSS-Protection)
- Enabling CORS for controlled access