Fix for Issue #3650#3894
Merged
Merged
Conversation
Problem: When a SAML IDP's metadata endpoint is unreachable, the ConfiguratorRelyingPartyRegistrationRepository catches the exception, returns null, and the DelegatingRelyingPartyRegistrationRepository falls through to the DefaultRelyingPartyRegistrationRepository which returns a stub registration pointing to https://www.cloudfoundry.org. The user gets redirected there with all SAML request parameters — confusing UX and a data leak.
Contributor
There was a problem hiding this comment.
Pull request overview
Prevents a security/UX failure mode in the SAML login flow where failures to fetch IdP metadata could previously fall through to the default stub relying party registration (sending users to https://www.cloudfoundry.org with SAML request parameters).
Changes:
- Fail fast in
ConfiguratorRelyingPartyRegistrationRepositoryby throwing aSaml2Exceptionon registration build errors (instead of returningnulland allowing fallback). - Improve
/error500handling to surface SAML failures asexternal_auth_errorfor both directSaml2Exceptionand “cause isSaml2Exception” cases. - Update/add tests to assert the new exception behavior and error page rendering.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| server/src/main/java/org/cloudfoundry/identity/uaa/provider/saml/ConfiguratorRelyingPartyRegistrationRepository.java | Throws Saml2Exception on metadata/build failures to prevent fallback to the default stub registration. |
| server/src/main/java/org/cloudfoundry/identity/uaa/home/HomeController.java | Extracts Saml2Exception (direct or cause) to return external_auth_error with 400 status. |
| server/src/test/java/org/cloudfoundry/identity/uaa/provider/saml/ConfiguratorRelyingPartyRegistrationRepositoryTest.java | Updates tests to expect Saml2Exception for invalid metadata inputs. |
| server/src/test/java/org/cloudfoundry/identity/uaa/login/HomeControllerViewTests.java | Adds coverage for a direct Saml2Exception passed to /error500. |
duanemay
approved these changes
May 5, 2026
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.
Problem: When a SAML IDP's metadata endpoint is unreachable, the ConfiguratorRelyingPartyRegistrationRepository catches the exception, returns null, and the DelegatingRelyingPartyRegistrationRepository falls through to the DefaultRelyingPartyRegistrationRepository which returns a stub registration
pointing to https://www.cloudfoundry.org. The user gets redirected there with all SAML request parameters — confusing UX and a data leak.