Expand description
Security middleware with production-safe defaults for Phoenix applications.
Structs§
- Access
Log - Emits query-free structured access logs and never records header values.
- Client
Ip - The client address after applying the trusted proxy policy.
- Client
IpRate Limit Key - Cors
- Applies an explicit CORS allowlist and handles preflight requests.
- Cors
Config - Cross-origin policy for browser requests.
- Csrf
- Synchronizer-token CSRF validation backed by the server-side session.
- Effective
Scheme - Request scheme after direct TLS and trusted forwarding policy are applied.
- Host
Allowlist - Rejects requests whose HTTP Host or URI authority is not explicitly allowed.
- Https
Redirect - Redirect cleartext requests to a configured canonical HTTPS authority.
- Https
Redirect Error - Memory
Rate Limit Backend - Shared in-memory backend used for local development and backend contract tests.
- Memory
Session Backend - Shared in-memory reference backend used by local applications and contract tests.
- Nonce
Security Policy - Request-scoped CSP nonce generation and browser security headers.
- Rate
Limit - Distributed-capable fixed-window limiter with an atomic backend contract.
- Rate
Limit Config - Fixed-window rate limit configuration.
- Rate
Limit Decision - Atomic result returned by a distributed rate-limit backend.
- Rate
Limit Store Error - Error returned by a rate-limit backend without exposing backend details to clients.
- Request
Id - Adds a fresh unpredictable request ID to every request and response.
- Request
IdValue - A request identifier available to controllers and logs.
- Security
Policy - Configurable CSP, HSTS, and browser hardening headers.
- Session
- A cloneable handle to one server-side session.
- Session
Backend Error - Sanitized backend error. The detail is available to operators, not HTTP clients.
- Session
Config - Cookie settings for server-side sessions.
- Session
Middleware - Loads and persists server-side sessions through a secure ID cookie.
- Session
Snapshot - Versioned server-side session state returned by a shared backend.
- Session
Store - In-process server-side session store.
- Trusted
Proxies - Resolves forwarding headers only when the direct peer is explicitly trusted.
Enums§
- CspPolicy
Error - Rate
Limit Failure Mode - Same
Site - Session
Write - Result of an atomic session mutation.
Traits§
- Rate
Limit Backend - Shared backend contract.
hitmust increment and decide in one atomic operation. - Rate
Limit Key - Produces a bounded backend key from trusted request context.
- Session
Backend - Distributed session contract.
Functions§
- effective_
scheme - Resolve the effective request scheme without trusting raw forwarding headers.
- redact_
headers - Return a diagnostic header map with credential-bearing values replaced.