Fix SAML encrypted assertion handling#3908
Open
duanemay wants to merge 6 commits into
Open
Conversation
7bdb875 to
5aea8e2
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes UAA’s SAML authentication flow so that encrypted assertions are decrypted even when the outer Response is unsigned, allowing signature policy to be evaluated against the decrypted assertion(s) (e.g., Entra ID unsigned response + signed, encrypted assertions) instead of blocking decryption based on wantAssertionSigned.
Changes:
- Always decrypt response-level encrypted assertions when present (even if the response itself is unsigned).
- Enforce the “response signed OR all assertions signed” policy after decryption and assertion processing.
- Update/extend unit tests to cover the unsigned-response + encrypted-and-signed-assertion scenario and align expected error messaging.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| server/src/main/java/org/cloudfoundry/identity/uaa/provider/saml/OpenSaml4AuthenticationProvider.java | Changes decryption gating to always decrypt when encrypted assertions exist; keeps signature-policy enforcement after assertion processing. |
| server/src/test/java/org/cloudfoundry/identity/uaa/provider/saml/OpenSaml4AuthenticationProviderUnitTests.java | Updates expected failure message and adds a regression test for unsigned response with encrypted signed assertion while wantAssertionSigned=true. |
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 SAML encrypted assertion handling when wantAssertionSigned=true
Problem
The UAA SAML authentication flow had a design flaw where the wantAssertionSigned configuration flag (default: true) would prevent decryption of unsigned SAML responses containing encrypted assertions, even when the encrypted assertions themselves were signed after decryption.
This caused UAA to reject perfectly valid and secure SAML configurations such as:
Microsoft Entra ID configured to encrypt assertions for privacy
Microsoft Entra ID configured to sign assertions for authenticity
UAA configured with default wantAssertionSigned = true
The flaw was in the logic that made decryption conditional on the signature policy flag, rather than evaluating encrypted content first and then applying signature policies.