-
Notifications
You must be signed in to change notification settings - Fork 8
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
in SAML response not sanitized before validation
#599
Comments
@ichi234 Would you check that this test case matches the SAML response that you have observed to be problematic? https://github.com/rileyw/saml20/blob/issue/599/test/assets/saml20.validResponseSignedMessage-unsanitized.xml#L7-L19 |
@rileyw Yes, it matches.
To put a little more detail into it, the value portion of a newline is formatted without line indentation as follows.
|
Facing same issue, I found another solution, loadSignature can take in a node or string, remove the toString solved it for me saml20/lib/validateSignature.ts Line 61 in 4a2b5f6
|
Summary
When validating a SAML response, if a newline in the response is
instead of
, it is not sanitized and the validation fails.Environment in which the event occurred
Related Library Versions
Detailed Situation
In the case in issue, the
X509Certificate
portion of the xml argument passed to the validateSignature.hasValidSignature method represented line breaks as
.This representation is not sanitized before use and therefore fails validation.
Actual response data (excerpts)
Proposed Solution
By manually modifying the contents under
node_modules
for testing, the following adjustment was found to resolve the issue:https://github.com/boxyhq/saml20/blob/main/lib/validateSignature.ts#L26
This modification ensures that
is appropriately sanitized, allowing the validation to proceed correctly.The text was updated successfully, but these errors were encountered: