Skip to content

Implement SAML SLO signature validation - #4015

Open
joemahady-comm wants to merge 1 commit into
cloudfoundry:developfrom
joemahady-comm:TNZGOV-15031
Open

Implement SAML SLO signature validation#4015
joemahady-comm wants to merge 1 commit into
cloudfoundry:developfrom
joemahady-comm:TNZGOV-15031

Conversation

@joemahady-comm

Copy link
Copy Markdown
Contributor

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.

Co-authored-by: Cursor <cursoragent@cursor.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SigAlg with INVALID_SIGNATURE instead 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();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants