symfony/security-http
Symfony Security HTTP integrates the Security Core component into HTTP applications, letting you secure parts of your app with firewalls and authenticate visitors through configurable authenticators. It bridges security policies and incoming requests.
security-http offers fine-grained control over authentication flows (OAuth, CAS, LDAP, JWT, OIDC) that are not natively available in Laravel’s default stack.PersistentRememberMeHandler, the login-link handler, and session-token logging).#66629 (token copied into logs) is a data-hygiene defect, not a functional one — it can leak session token material into log sinks on any branch that shares the logging path.#65685 (login-link max_uses race) and #65734 (malformed login-link parameters) are authentication-strength issues in the login-link subsystem.#65735 (malformed remember-me cookie → failure) is a robustness/DoS-adjacent fix in PersistentRememberMeHandler.web, api), custom middleware (AuthenticateMiddleware, CsrfTokenMiddleware), and extension of Laravel’s auth middleware to delegate to Symfony’s AuthenticatorManager.UserProvider is wrapped behind Symfony’s UserProviderInterface; OAuth/JWT/LDAP/OIDC require custom adapters (e.g. league/oauth2-client).PersistentRememberMeHandler): only relevant if we enable persistent login. If we do, we inherit the malformed-cookie failure mode until the equivalent fix is verified in 8.1.x.#65685/#65734 are informational — but they must still be recorded as accepted-and-not-applicable, not silently ignored.#66421 binds discovered OIDC keys to their issuers. For multi-IdP Laravel deployments this closes a key-confusion class of weakness. We pin symfony/security-http >= 8.1.8; this constraint is set now, not migrated to later.#[IsGranted]) maps to Laravel’s policy system or custom middleware.| Risk Area | Assessment | Mitigation |
|---|---|---|
| Middleware Conflicts | Laravel’s middleware pipeline may conflict with Symfony’s firewall logic. | Priority-based middleware ordering plus decorator pattern for integration. |
| Authentication Overhead | Symfony’s AuthenticatorManager is more complex than Laravel’s AuthManager. |
Abstract Symfony’s logic behind a Laravel-compatible facade (SymfonyAuthManager). |
| CSRF & Session Handling | Symfony’s CsrfTokenManager differs from Laravel’s CsrfGuard. |
Dual-layer CSRF: Laravel’s for forms, Symfony’s for APIs, with a documented ownership matrix. |
| OIDC Key/Issuer Confusion | Resolved by upgrade — pre-8.1.8 builds did not bind discovered OIDC keys to issuers. | Pin >= 8.1.8; assert one key-set per configured issuer; negative test with a foreign-issuer token. |
| Cross-Branch Fix Propagation (new) | v5.4.54 is a [SECURITY] release on a branch we do not run. Assuming 8.1.x already contains these fixes is an unchecked assumption. | Obtain commit-level confirmation that each of #66629, #65735, #65734, #65685 is fixed on the 8.1.x line (or a documented non-applicability); record as an ADR addendum. If any is unpatched on 8.1.x, treat as an open security finding with an owner and date. |
| Token Material in Logs (new) | #66629 — the security token could be copied from the session into logs. Log sinks are frequently shipped to third-party aggregators with broader access than the app itself. |
Treat existing log stores as potentially credential-bearing: audit log payloads for token fields, purge/expire affected retention windows, and enforce a redaction rule on token/session objects before any logger sees them. Never rely on upstream having kept logs clean. |
| Login-Link Abuse (new, conditional) | #65685 narrows a race allowing a login link to exceed max_uses; #65734 rejects malformed login-link parameters instead of raising TypeError. |
Only if we adopt passwordless links: single-use enforcement must be server-side and atomic, and malformed input must return a clean 4xx rather than a 500. Add both as acceptance criteria. |
| Performance Impact | Symfony’s security layer adds per-request overhead (token validation, firewall checks). | Cache firewall configuration; optimize authenticator pipelines. |
| Deprecation Risks | Symfony 8.x deprecates some features (e.g. RememberMeDetails FQCN). |
Audit Laravel’s auth stack; plan migrations (FQCN → UID). |
| Patch-Line Drift | Now spanning two tracked lines: our 8.1.x pin and the upstream 5.4 LTS security stream that generated this release. | Track both explicitly in the ADR. Enforce a minimum patch floor (^8.1.8) via CI; separately monitor 5.4.x security advisories as an early-warning signal for fixes that may not yet be backported forward. |
AuthenticatorManager in Laravel’s suite, and can we build a negative-path auth suite (foreign issuer, tampered token, revoked key, replayed login link) before cutover?| Laravel Component | Symfony security-http Equivalent |
Integration Strategy |
|---|---|---|
| Laravel Middleware | Firewall Middleware (FirewallContext) |
Wrap Symfony middleware in Laravel’s Handle class. |
| Laravel Auth Controller | AbstractAuthenticator |
Extend AuthenticatorInterface for Laravel’s LoginController. |
| Laravel Policies | VoterInterface |
Map #[IsGranted] to Laravel’s authorize(). |
| Laravel Sanctum/JWT | OidcAuthenticator, JwtAuthenticator |
Use Symfony’s token handlers for JWT/OIDC; require >= 8.1.8 for issuer-bound key discovery. |
| Laravel Session | SessionAuthenticationStrategy |
Delegate session handling to Symfony’s SessionStorage. |
| Laravel Remember Me | PersistentRememberMeHandler |
Only if enabled: verify the #65735 malformed-cookie fix is present on 8.1.x before exposing it. |
| Laravel Logging | Session/token debug logging | Redact token objects at the logger boundary — do not depend on the #66629 fix alone. |
| Laravel CSRF | CsrfTokenManager |
Hybrid: Laravel’s CSRF for forms, Symfony’s for APIs. |
symfony/security-http to ^8.1.8 in composer.json; do not carry the BETA3 baseline forward.AuthenticatesUsers trait with a Symfony Authenticator extending AbstractAuthenticator; hook into Laravel’s auth.attempt.AuthorizationCheckerInterface.FirewallMap and route requests to firewalls via Laravel’s middlewareGroups; enforce priority-based ordering.| Compatibility Check | Status | Notes |
|---|---|---|
| Laravel 10.x + Symfony 8.1.8 | ✅ Compatible | PHP 8.1+, PSR-15 middleware. |
| Symfony 8.1.0-BETA3 → 8.1.8 | ✅ Drop-in | Patch-level; no breaking changes. |
| v5.4.54 as an upgrade target | ❌ Not applicable | Legacy 5.4 LTS line. Do not install. Consume as a security signal only; verify forward propagation to 8.1.x. |
Laravel’s auth() Helper |
⚠️ Partial | Requires a custom facade delegating to Symfony’s SecurityContext. |
Laravel’s Session |
✅ Compatible | Symfony’s SessionStorage integrates with Laravel’s session driver. |
Laravel’s Request Object |
✅ Compatible | Symfony’s RequestStack can consume Laravel’s Request. |
Laravel’s Event System |
⚠️ Custom Binding | Symfony’s SecurityEvents must be mapped to Laravel events (auth.attempted, etc.). 8.1.8 corrects the declared event-dispatcher type (#66118) — re-run bridge tests against the corrected typing. |
DebugListener; confirm debug output does not emit token material.FormLoginAuthenticator; Step 2 OAuth/JWT/OIDC on the 8.1.8 floor; Step 3 policies → #[IsGranted].AuthManager in favor of Symfony’s AuthenticatorManager; move CSRF, logout, and session handling to Symfony components.| Aspect | Impact | Mitigation |
|---|---|---|
| Dependency Updates | Security patches arrive on the live 8.1.x line. v5.4.54 shows upstream is still shipping security fixes to a legacy line, which means some fixes may land there before (or instead of) our line. | Adopt a patch-floor policy (^8.1.8); triage 8.1.x entries tagged bug/security within one sprint; treat 5.4.x security advisories as an early-warning feed requiring a same-sprint propagation check. |
| Two-Line Awareness (new) | We now track 8.1.x as our install target and 5.4.x as a signal source. Conflating them risks either a mistaken downgrade or a missed fix. | Document both in the ADR; CI enforces ^8.1.8; a named owner reviews the 5.4.x security stream monthly. |
| Log Hygiene (new) | #66629 means token material may already exist in logs and log aggregators. |
Audit sinks, purge affected retention windows, add redaction at the logger boundary, and confirm debug tooling in non-prod is not shipping tokens. |
| Version Policy | Team may keep the BETA3 pin because “it works.” | Treat BETA3 as unsupported; enforce the floor via CI/composer audit. |
| Upgrade Cadence | 8.1.x patch releases are small (2 changes in 8.1.8) and low-effort. | Bundle into the regular dependency cadence; no dedicated migration work. |
auth() semantics are not natively understood by the Symfony firewall. Our facade layer is bespoke code and will be the durable support burden, not the upstream package.#66629 class of defect crosses team boundaries — application auth, platform logging, and any SIEM/observability vendor. Assign an owner for token redaction and log retention, not just for auth code.| Failure Mode | Symptom | Response |
|---|---|---|
| Token material in logs (new) | Session tokens readable in app logs or in a log aggregator. | Redact at the logger boundary; purge affected retention windows; rotate any exposed sessions. Do not wait on a package upgrade for this. |
| Unverified fix propagation (new) | A fix present on 5.4.x is assumed to be on 8.1.x and is not. | Commit-level verification per security advisory; open finding with owner/date if unmatched. |
| Login-link over-use (new, conditional) | A single-use link is redeemed more than max_uses times under race conditions. |
Atomic server-side single-use enforcement; concurrency test on redemption. |
| Malformed remember-me cookie (new, conditional) | Unhandled error/500 on cookie tampering. | Fail closed with a clean re-auth challenge; fuzz the cookie parser. |
| Foreign-issuer token acceptance | Token from IdP A accepted on IdP B’s firewall. | Fixed by 8.1.8; verify with a negative test. |
| Firewall misordering | Auth bypass or double-authentication on mixed web/api routes. |
Priority-based middleware ordering plus per-route-group integration tests. |
| Dual CSRF divergence | Form posts succeed, API posts 419 (or vice versa). | Single documented matrix of which guard owns which surface. |
| Event bridge drift | SecurityEvents stop reaching Laravel listeners after a patch. |
Regression test on the bridge after every 8.1.x bump (#66118). |
| Silent version downgrade | A dependency PR resolves below the security floor. | CI constraint check on symfony/security-http. |
How can I help you explore Laravel packages today?