Gate SSO routes on the configured active provider

fix(auth): gate SSO routes on the configured active provider
Gate SSO routes on the configured active provideradc6d8-fix-gate-sso-routes-on-the-configured-cve-2026-102894fixgate sso routes configured active provider

Committed by gitlawr

commit message
fix(auth): gate SSO routes on the configured active provider

The SAML and OIDC login/callback routes were always live: on a
deployment that never enabled them they would still parse
attacker-supplied IdP payloads (SAMLResponse bytes, OIDC token
exchange), needlessly widening the attack surface. Only CAS guarded
its routes, via an ad-hoc cas_server_url presence check.
 
Group each provider's routes under a sub-router carrying a
_provider_gate dependency that rejects the request with 400 unless
external_auth_type resolves to that provider. Applying the gate at the
router level makes it structural — every current and future route in
the group is covered without the handler having to remember — and
unifies CAS onto the same, stricter check.
 
Tests cover both the _require_active_provider() check directly and the
router wiring end-to-end over HTTP (a mismatched external_auth_type
yields 400), so a dropped mount or missing dependency is caught as a
regression.

Editor assessment

This commit patches CVE-2026-102894. A second excellent message from the same series. The body explains that SAML and OIDC routes were always mounted, so a deployment that never enabled them still parsed attacker-supplied IdP payloads, and that only CAS had an ad-hoc guard. The fix groups each provider's routes under a sub-router carrying a _provider_gate dependency, which makes coverage structural rather than per-handler, and unifies CAS onto the stricter check. Tests exercise both the helper and the HTTP wiring, so a dropped mount is caught as a regression.

Browse categories

More fix examples · Back to search