-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
SAML2: Wrong IdP response URL throws NPE (for non-existing "RelyingParty") #7865
Comments
Thanks for the report @berschmoe. Could you please provide a minimal sample that reproduces this issue? |
It can be reproduce with a unit test or the SAML2 sample. Unit TestThis test method (for Saml2WebSsoAuthenticationFilterTests) simulates the behavior. "CASE 2" throws the NullPointerException. The mocked RelyingPartyRegistrationRepository behaves the same as the implementation - if no entry exists, it returns null.
Spring Boot 2.x SampleTo reproduce this behavior in "real life" you can use the Spring Boot 2.x Sample project (https://docs.spring.io/spring-security/site/docs/5.2.1.RELEASE/reference/htmlsingle/#samllogin-sample-boot)
Now I setup up Okta and make a small spelling mistake - instead of okta I wrote otak. Launch Spring Boot application, open http://localhost:8080 and you will be caught in an endless loop. The app redirect to Okta, Okta redirect to the app (with the wrong registration id), the NPE occurs. App redirect to Okta, Okta redirect ... |
Thanks for the report @berschmoe. It will now throw a |
Summary
Configure an invalid response URL at the identity provider (using nonconfigured registration id) a NullPointerException occurs during authentication process.
E.g. registrationId is okta (at your service provider) but at the identity provider the configured response URL is http://mydomain/login/saml2/sso/anythingElse.
The Saml2WebSsoAuthenticationFilter does not check if the requested "RelyingParty" exits. If the RelyingPartyRegistrationRepository return null, processing not stopped.
Expected Behavior
no NPE :-)
Version
5.2.1.RELEASE
The text was updated successfully, but these errors were encountered: