Fix CSRF token leakage in SAML POST binding template#241
Merged
Zogoo merged 2 commits intosaml-idp:masterfrom Feb 2, 2026
Merged
Fix CSRF token leakage in SAML POST binding template#241Zogoo merged 2 commits intosaml-idp:masterfrom
Zogoo merged 2 commits intosaml-idp:masterfrom
Conversation
Contributor
Author
|
I noticed that the code example in the wiki contains the same issue. |
Collaborator
|
The Saml IdP gem allows an IdP application to use its own template by overwriting the default one. |
Contributor
Author
|
While this should be handled at the application level, the wiki and this template are often copied as-is. Using form_tag implicitly includes an authenticity token, which then gets posted to the SP. Since this is unnecessary for SAML POST binding, adjusting the examples would provide a safer reference. |
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.
This PR replaces
form_tagwith a plain HTML<form>tag inspec/rails_app/app/views/saml_idp/idp/saml_post.html.erb.While this template is part of the spec Rails app, it is often used as a reference for actual implementation. Using
form_tagautomatically includes an authenticity token, which is unnecessary for SAML POST binding and results in leaking the IdP's CSRF token to Service Providers.This change ensures that only the required SAML parameters are sent to the SP.