Why this matters
Meets SOC 2 encryption and logging controls.
Serve via rustls with TLS1.2+ and add middleware to log JSON audit events with user_id and request_id; never log raw tokens.
Meets SOC 2 encryption and logging controls.
Side-by-side examples engineers can pattern-match during review.
HttpServer::new(|| App::new().route("/", web::get().to(index)))HttpServer::new(|| App::new().wrap(Audit)).bind_rustls("0.0.0.0:443", cfg_with_tls12())?info!("action"="auth.login", "trace_id"=%tid)println!("login")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.