-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Add InResponseTo validation support #9174
Comments
@fast-reflexes, you are correct - this is because the AuthNRequest is not saved anywhere after the relying party generates and sends it to the asserting party. I've created a ticket to add that support - #9185 - where your contribution would be most welcome. Once that is complete, we can take a closer look at this ticket to see how to best validate |
@jzheaux Thanks for answering! No, go ahead and reword it! |
@fast-reflexes Now that As I see it, there are two things needed:
Are you able to provide a PR along those lines? If not, I believe I have some time to do it. |
@jzheaux I have the same problem currently. I have 2 thoughts on that topic currently:
What do you think? |
@jzheaux Yes, I would really like to start contributing so could you give me a week to do it and I will either do it in that time or let someone else ahead? |
@bitrecycling, good questions:
I think that it's important to confirm that the
A SAML Response has an expiry. Given that, you should be able to create a cache of IDs that you can check against for replay attacks. For the time being, I think Spring Security's default validation should remain minimal so that it's easy to extend and replace, but I do think a component like that could be interesting for you to share, should you create one. |
@jzheaux after thinking it through, I currently would argue against ID validation at least for login where it's most critical. Reasoning:
So given the high value of and (relatively) easy and lightweight validation of "inResponseTo" I would go that path to prevent false or doubly issued login responses. And rather not implement the difficult to handle and maintain IDs Storage to check against especially given that it might not even provide real value. I am sorry this got lengthy, but I would really appreciate your opinion. If you still think it could be useful, I might come up with a solution. I definitely need a solution for the inReponseTo validation though, probably even earlier than @fast-reflexes can provide, so I will likely come up with my own implementation. /Robert |
@jzheaux I've started working on it. So we should always validate if it is present in the response, no user flag to indicate whether the validation functionality is desired or not? |
Good question, @fast-reflexes. I think you'd validate it if both the request and response are present and the response has an To turn off that validation, applications can always either:
|
A question, if the login is unsolicited, there won't be a request stored, but if there IS a request stored but the response does NOT have |
Whenever an InResponseTo is present in the SAML2 response and / or any of its assertions, it will be validated against the stored SAML2 request. If the request is missing or the ID of the request does not match the InResponseTo, validation fails. If there is no InResponseTo, no validation of it is done (as opposed to checking whether there is a saved request or not and then failing based on that). Closes spring-projectsgh-9174
- Moved methods so methods are listed before the methods they call - Adjusted exception handling so no exceptions are eaten - Adjusted so that malformed_request_data is returned with request data is malformed - Refactored methods to have only immutable method parameters - Removed usage of Stream API - Moved AuthnRequestUnmarshaller into static block so that only looked up once Issue gh-9174
Whenever an InResponseTo is present in the SAML2 response and / or any of its assertions, it will be validated against the stored SAML2 request. If the request is missing or the ID of the request does not match the InResponseTo, validation fails. If there is no InResponseTo, no validation of it is done (as opposed to checking whether there is a saved request or not and then failing based on that). Closes gh-9174
- Moved methods so methods are listed before the methods they call - Adjusted exception handling so no exceptions are eaten - Adjusted so that malformed_request_data is returned with request data is malformed - Refactored methods to have only immutable method parameters - Removed usage of Stream API - Moved AuthnRequestUnmarshaller into static block so that only looked up once Issue gh-9174
Describe the bug
The InResponseTo field is not validated and the repsonse is not rejected when this does not correspond to a sent request.
To Reproduce
Expected behavior
If the request contains a InResponseTo which is incorrect, it should be rejected.
Sample
A link to a GitHub repository with a minimal, reproducible sample.
Reports that include a sample will take priority over reports that do not.
At times, we may require a sample, so it is good to try and include a sample up front.
The text was updated successfully, but these errors were encountered: