Repository navigation
Fixes #39253: Accept SAML strict-mode sign-ins behind a TLS-terminating proxy - #39255
Conversation
…ng proxy
With Strict Mode on, java-saml compares a response's Destination and the
Recipient of its bearer SubjectConfirmationData with the URL the request
arrived on. When TLS ends at a load balancer, the server sees the identity
provider's post to the https ACS arrive over http, so every response was
rejected ("The response was received at http://... instead of
https://..."), on the live login and on Test Login.
Both paths now have java-saml compare with the configured ACS URL, the URL
SamlResponseValidator already compares Destination with outside strict
mode. A response addressed to any other URL is still rejected.
ADR:2026-11-27-saml-strict-mode-checks-the-configured-acs-url
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
…ng proxy (backport 2.0 #39255) (#39257) With Strict Mode on, java-saml compares a response's Destination and the Recipient of its bearer SubjectConfirmationData with the URL the request arrived on. When TLS ends at a load balancer, the server sees the identity provider's post to the https ACS arrive over http, so every response was rejected ("The response was received at http://... instead of https://..."), on the live login and on Test Login. Both paths now have java-saml compare with the configured ACS URL, the URL SamlResponseValidator already compares Destination with outside strict mode. A response addressed to any other URL is still rejected. 2.0's Test Login already installs a response factory that checks the response answers its request, so atConfiguredAcs wraps that factory's response. The decision record cites #37437 in place of a record 2.0 does not have. ADR:2026-11-27-saml-strict-mode-checks-the-configured-acs-url
…ng proxy (backport 2.1 #39255) (#39256) With Strict Mode on, java-saml compares a response's Destination and the Recipient of its bearer SubjectConfirmationData with the URL the request arrived on. When TLS ends at a load balancer, the server sees the identity provider's post to the https ACS arrive over http, so every response was rejected ("The response was received at http://... instead of https://..."), on the live login and on Test Login. Both paths now have java-saml compare with the configured ACS URL, the URL SamlResponseValidator already compares Destination with outside strict mode. A response addressed to any other URL is still rejected. ADR:2026-11-27-saml-strict-mode-checks-the-configured-acs-url
Code Review ✅ Approved 🔴 High riskChanging strict-mode SAML Destination and Recipient checks alters the authentication boundary; an incorrect ACS setting could reject legitimate sign-ins. Makes SAML strict-mode sign-ins work behind a TLS-terminating proxy by comparing the response's Destination and Recipient against the configured ACS URL via java-saml's setDestinationUrl hook, for both live login and Test Login. Responses addressed to other ACS URLs are still rejected. No issues found. VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Describe your changes:
Fixes #39253
With Strict Mode on, every SAML sign-in behind a TLS-terminating load balancer or ingress fails, both the live login and Test Login:
Why: in strict mode java-saml compares the response's
Destination, and theRecipientof its bearerSubjectConfirmationData, withHttpServletRequest.getRequestURL(). When TLS ends at the proxy, Jetty sees plain HTTP.useForwardedHeadersis off by default (SERVER_USE_FORWARDED_HEADERS), so it reportshttp://, while the IdP addresses the response to the configuredhttps://ACS. Since the settings form shows Want Messages/Assertions Signed only while Strict Mode is on, such a deployment can't require signed responses.Fix: both paths that hand java-saml a response (the live ACS in
SamlAuthServletHandlerand Test Login inTestLoginSamlHandler) now have it compare with the configured ACS URL. This uses java-saml's ownSamlResponse.setDestinationUrlhook, through the newSamlResponseValidator.atConfiguredAcs. Outside strict mode,SamlResponseValidator.validatealready comparesDestinationwith the same configured URL. A response addressed to any other URL is still rejected.Turning on forwarded headers was not used as the fix. It trusts client-supplied
X-Forwarded-*on every request unless the proxy overwrites them, and every deployment would have to know to set it. The rule is recorded indocs/decisions/2026-11-27-saml-strict-mode-checks-the-configured-acs-url.md.Backports: 2.1 #39256, 2.0 #39257.
Type of change:
High-level design:
N/A — small change.
Tests:
Use cases covered
https://…, and the IdP's post reaches the server ashttp://…: the live login completes (303 to the completion page), and Test Login passes "Sign-in response validated".Unit tests
SamlResponseValidatorTest:strictModeComparesDestinationAndRecipientWithTheConfiguredUrl,strictModeStillRejectsAResponseAddressedToAnotherAcsSamlAuthServletHandlerTest#handleCallback_strictModeAcceptsAResponseThatATlsTerminatingProxyForwardedOverHttpTestLoginSamlHandlerTest#strictModeAcceptsAResponseThatATlsTerminatingProxyForwardedOverHttp*Saml*TestandTestLogin*Testclasses pass locally (242 tests).Backend integration tests
Playwright (UI) tests
Manual testing performed
Reproduced with java-saml 2.9.0 and the repo's
MockSamlIdp, using settings built the waySamlSettingsHolder.buildSettingsbuilds them:http://: accepted.http://, ACShttps://: rejected with the message above.https://(what forwarded headers would give): accepted.http://, compared with the configured ACS (this fix): accepted.Not tested against a real identity provider behind a TLS-terminating proxy.
🤖 Generated with Claude Code