Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump opensaml2 from 2.6.6 to 4.0.1 #2908

Open
wants to merge 198 commits into
base: develop
Choose a base branch
from

Conversation

Tallicia
Copy link
Contributor

@Tallicia Tallicia commented May 30, 2024

Replacing the other feature branch #2862 for new SAML library replacement effort.

Sonar
https://sonarcloud.io/summary/new_code?id=cloudfoundry-identity-parent&pullRequest=2908

@Tallicia Tallicia added in progress DO NOT MERGE Internal Test or WIP, please DO NOT MERGE labels May 30, 2024
@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/187710947

The labels on this github issue will be updated when the story is started.

@Tallicia Tallicia changed the title New saml 0530 New SAML 2024.05.30 - Not to merge but just for SAML feature branch testing May 30, 2024
@duanemay duanemay force-pushed the new-saml-0530 branch 5 times, most recently from 65b0d64 to e67a40a Compare June 14, 2024 22:11
@duanemay duanemay force-pushed the new-saml-0530 branch 9 times, most recently from a761b67 to 7de27a1 Compare June 24, 2024 15:54
@duanemay duanemay force-pushed the new-saml-0530 branch 2 times, most recently from 0d3a595 to f199f50 Compare July 5, 2024 22:17
@duanemay duanemay force-pushed the new-saml-0530 branch 2 times, most recently from 46248b9 to b6cb65b Compare July 9, 2024 18:49
@peterhaochen47 peterhaochen47 force-pushed the new-saml-0530 branch 2 times, most recently from a97457f to 745fff3 Compare July 10, 2024 17:04
@strehle strehle added scheduled in_review The PR is currently in review and removed unscheduled labels Nov 12, 2024
@strehle strehle changed the title New SAML 2024.05.30 - Not to merge but just for SAML feature branch testing build(deps): bump opensaml2 from 2.6.6 to 4.0.1 Nov 12, 2024
@strehle strehle marked this pull request as ready for review November 12, 2024 17:44
* Cleanup libraries not needed anymore

bound to old opensaml

* Remove ESAPI finally

this dependency is only there because of old saml

* fix rebase
@strehle strehle requested review from a team, strehle and duanemay November 12, 2024 17:50
}

if (!identityProviderDefinitions.isEmpty()) {
SamlIdentityProviderDefinition identityProviderDefinition = identityProviderDefinitions.get(0);
Copy link
Member

Choose a reason for hiding this comment

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

This is an unexpected behavior, because we use then first found trust material to verify the incoming SAML message.


for (SamlIdentityProviderDefinition identityProviderDefinition : identityProviderDefinitions) {
if (identityProviderDefinition.getIdpEntityAlias().equals(registrationId)) {
return createRelyingPartyRegistration(registrationId, identityProviderDefinition, currentZone);
Copy link
Member

Choose a reason for hiding this comment

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

This is a search by origin only. In case of SAML bearer we dont have the origin key in the token (SAML assertion) but only the issuer.
A loop is something I would like to omit because we now have an alternative , see #2825

<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:X509Data>
<ds:X509Certificate>
MIIEEzCCAvugAwIBAgIJAIc1qzLrv+5nMA0GCSqGSIb3DQEBCwUAMIGfMQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ08xFDASBgNVBAcMC0Nhc3RsZSBSb2NrMRwwGgYDVQQKDBNTYW1sIFRlc3RpbmcgU2VydmVyMQswCQYDVQQLDAJJVDEgMB4GA1UEAwwXc2ltcGxlc2FtbHBocC5jZmFwcHMuaW8xIDAeBgkqhkiG9w0BCQEWEWZoYW5pa0BwaXZvdGFsLmlvMB4XDTE1MDIyMzIyNDUwM1oXDTI1MDIyMjIyNDUwM1owgZ8xCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDTzEUMBIGA1UEBwwLQ2FzdGxlIFJvY2sxHDAaBgNVBAoME1NhbWwgVGVzdGluZyBTZXJ2ZXIxCzAJBgNVBAsMAklUMSAwHgYDVQQDDBdzaW1wbGVzYW1scGhwLmNmYXBwcy5pbzEgMB4GCSqGSIb3DQEJARYRZmhhbmlrQHBpdm90YWwuaW8wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC4cn62E1xLqpN34PmbrKBbkOXFjzWgJ9b+pXuaRft6A339uuIQeoeH5qeSKRVTl32L0gdz2ZivLwZXW+cqvftVW1tvEHvzJFyxeTW3fCUeCQsebLnA2qRa07RkxTo6Nf244mWWRDodcoHEfDUSbxfTZ6IExSojSIU2RnD6WllYWFdD1GFpBJOmQB8rAc8wJIBdHFdQnX8Ttl7hZ6rtgqEYMzYVMuJ2F2r1HSU1zSAvwpdYP6rRGFRJEfdA9mm3WKfNLSc5cljz0X/TXy0vVlAV95l9qcfFzPmrkNIst9FZSwpvB49LyAVke04FQPPwLgVH4gphiJH3jvZ7I+J5lS8VAgMBAAGjUDBOMB0GA1UdDgQWBBTTyP6Cc5HlBJ5+ucVCwGc5ogKNGzAfBgNVHSMEGDAWgBTTyP6Cc5HlBJ5+ucVCwGc5ogKNGzAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAvMS4EQeP/ipV4jOG5lO6/tYCb/iJeAduOnRhkJk0DbX329lDLZhTTL/x/w/9muCVcvLrzEp6PN+VWfw5E5FWtZN0yhGtP9R+vZnrV+oc2zGD+no1/ySFOe3EiJCO5dehxKjYEmBRv5sU/LZFKZpozKN/BMEa6CqLuxbzb7ykxVr7EVFXwltPxzE9TmL9OACNNyF5eJHWMRMllarUvkcXlh4pux4ks9e6zV9DQBy2zds9f1I3qxg0eX6JnGrXi/ZiCT+lJgVe3ZFXiejiLAiKB04sXW3ti0LW3lx13Y1YlQ4/tlpgTgfIJxKV6nyPiLoK0nywbMd+vpAirDt2Oc+hk
Copy link
Member

Choose a reason for hiding this comment

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

Can we omit the key (default key) in the production ?

I found identitfied this xml as part of test package... if the template is needed isnt a constant string (without key) a better approach ?


@Override
public Authentication convert(HttpServletRequest request) throws AuthenticationException {
RelyingPartyRegistration relyingPartyRegistration = relyingPartyRegistrationResolver.resolve(request, null);
Copy link
Member

Choose a reason for hiding this comment

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

This returns the dummy IdP registration.

boolean addNew;
IdentityProvider<SamlIdentityProviderDefinition> idp;
SamlIdentityProviderDefinition samlConfig;
try {
Copy link
Member

Choose a reason for hiding this comment

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

a 2nd lookup in DB. right now dont have a better idea, but I would do it earlier, before signature validation


Assertion assertion = parseAssertion(assertionXml);
Saml2AuthenticationToken authenticationToken = new Saml2AuthenticationToken(relyingPartyRegistration, assertionXml);
process(authenticationToken, assertion);
Copy link
Member

Choose a reason for hiding this comment

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

here we validate signature, but we are not confident that we have the correct IdP

Did not found a security problem, but the error messages are misleading because then you see always signature error message

return Base64.getEncoder().encodeToString(b);
}

public static byte[] samlDecode(String s) {
Copy link
Member

Choose a reason for hiding this comment

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

missing methods for SAML bearer which needs UrlDecoder for Base64.

@strehle
Copy link
Member

strehle commented Nov 14, 2024

SAML2 bearer and IdP initated flows are similar and the IdP initiated flow still is not working.
The tests work, but this is by accident because we have only one trusted IdP and the TODO in resolution of IdP.

The resolver needs to be forked / implemented on Uaa side, I assume then we can resolve from issuer to idP .
With more than 1 trusted IdP the flow is working by accident...

SAML2 bearer works now independent from amount of SAML2 trusts, #3132

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DO NOT MERGE Internal Test or WIP, please DO NOT MERGE in_review The PR is currently in review scheduled
Projects
Status: Pending Review | Discussion
Development

Successfully merging this pull request may close these issues.

Spring Security SAML2 End of Life
10 participants