Implement SAML SLO signature validation - #4015
Open
joemahady-comm wants to merge 1 commit into
Open
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR re-enables strict signature validation for SAML Single Logout (SLO) LogoutRequests, ensuring unsigned/malformed REDIRECT-binding requests are rejected rather than being implicitly accepted via error filtering or bypass behavior.
Changes:
- Reject REDIRECT-binding SLO LogoutRequests that omit
SigAlgwithINVALID_SIGNATUREinstead of bypassing validation. - Update unit tests to stop expecting missing-signature errors to be filtered out and to assert rejection for unsigned redirect requests.
- Update the SAML integration test to assert the user remains logged in after an IdP-initiated logout attempt using an unsigned SLO request.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| uaa/src/test/java/org/cloudfoundry/identity/uaa/integration/feature/SamlLoginIT.java | Updates IdP-initiated logout flow assertion to ensure unsigned SLO does not log the user out of UAA. |
| server/src/test/java/org/cloudfoundry/identity/uaa/authentication/SamlLogoutRequestValidatorTest.java | Removes the missing-signature-error filtering test and asserts unsigned redirect requests are rejected. |
| server/src/main/java/org/cloudfoundry/identity/uaa/authentication/SamlLogoutRequestValidator.java | Removes permissive filtering/bypass behavior and returns INVALID_SIGNATURE when SigAlg is absent for REDIRECT binding. |
Comment on lines
+80
to
83
| assertThat(result.hasErrors()).isTrue(); | ||
| assertThat(result.getErrors()).hasSize(1); | ||
| assertThat(result.getErrors().iterator().next().getDescription()).isEqualTo("Missing signature"); | ||
| } |
Comment on lines
32
to
40
| // Spring Security 7.1.0 throws NPE in RedirectParameters when SigAlg is absent (unsigned | ||
| // redirect-binding logout request). Restrict bypass to REDIRECT binding only — POST binding | ||
| // uses XML signatures (not HTTP params) and must go through the delegate unchanged. | ||
| if (parameters != null | ||
| && parameters.getLogoutRequest().getBinding() == Saml2MessageBinding.REDIRECT | ||
| && parameters.getLogoutRequest().getParameters().get(Saml2ParameterNames.SIG_ALG) == null) { | ||
| // Signature present without SigAlg is malformed — reject rather than bypass. | ||
| if (parameters.getLogoutRequest().getParameters().get(Saml2ParameterNames.SIGNATURE) != null) { | ||
| return Saml2LogoutValidatorResult.withErrors(new Saml2Error( | ||
| Saml2ErrorCodes.INVALID_SIGNATURE, "Signature present without SigAlg")).build(); | ||
| } | ||
| return SamlUnsignedMessageValidator.validateLogoutRequest( | ||
| parameters.getLogoutRequest().getSamlRequest(), | ||
| parameters.getLogoutRequest().getBinding(), | ||
| parameters.getRelyingPartyRegistration()); | ||
| return Saml2LogoutValidatorResult.withErrors(new Saml2Error( | ||
| Saml2ErrorCodes.INVALID_SIGNATURE, "Missing signature")).build(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Re-enabled strict signature verification for SAML Single Logout (SLO) requests by removing overly permissive error filtering.
Details: In SamlLogoutRequestValidator, previously an issue filtered out any SAML validation errors containing the word "signature". We removed this bypass so that if an unsigned SAML LogoutRequest arrives via the REDIRECT binding without a SigAlg parameter, it now accurately rejects the request with an INVALID_SIGNATURE error.