Replies: 3 comments 7 replies
-
You did not provide Background: From SAML response integrity point of view SAML authentication response is considered safe if it has valid top level signature (Response level) or if assertion element is signed.
source: https://shibboleth.atlassian.net/wiki/spaces/IDP30/pages/2504884338/SAML2SSOConfiguration
First it tries to validate top level (aka Response) signature: passport-saml/src/node-saml/saml.ts Lines 761 to 765 in 6ba76ba if this validation succeeded it set validSignature = true . If top level (aka Response level) signature validation failed due some reason (invalid certificate, malformed certificate or man in the middle had modified content of response level elements but not assertion level elements or response element did not have associated xml signature) it - passport-saml - considers this as "soft failure" i.e. validSignature = false and it proceeds to check whether assertion is validly signed.
If passport-saml/src/node-saml/saml.ts Lines 783 to 788 in 6ba76ba In case of encrypted assertions: passport-saml/src/node-saml/saml.ts Lines 812 to 817 in 6ba76ba if assertion signature validation was successfull it proceeds to consume values from assertion. If assertion signature validation failed it reports Reasons for failure are among other things: man in the middle had modified content of assertion, certificate was malformed, certificate was invalid, assertion did not have associated xml signature Furthermore: SP and IdP administrators can configure various way how SAML response is signed. I.e. SAML response could have
Now lets look at your question (for full disclosure I have not used Onelogin). One of the pictures show that "SAML signature element" dropdown has "Response". I assume it means that with that choice Onelogin signs just top level element (Response) and leaves assertion unsigned. So keeping in mind background and your configuration choises reason for the observed behaviour could be that:
If I were you I would debug why this validation failed: passport-saml/src/node-saml/saml.ts Lines 761 to 765 in 6ba76ba One of the pictures show that
If your PS. some other SP implementations provide configuration options to "fail hard if there should be valid top level signature and validation of top level signature failed".
source: https://shibboleth.atlassian.net/wiki/spaces/IDP30/pages/2504884338/SAML2SSOConfiguration |
Beta Was this translation helpful? Give feedback.
-
For what it's worth, I am running into this issue with Google Workspace SAML. This is because by default, Google only signs the assertions, not the entire response. Even after enabling "Sign response" it's still not working for me (and I've validated the SAML using https://www.samltool.com/validate_response.php). My current solution is to set |
Beta Was this translation helpful? Give feedback.
-
Just to share my learning on this topic, I ran into this with a simple upgrade from passport-saml to @node-saml/passport-saml. I'm using OneLogin as my test IdP. After some head scratching, I read this post and went back to check the following setting in the OneLogin IdP configuration: Be sure to check "Both". This solved my issue and I appreciate the signature checking algorithm description posted by @srd90 !! |
Beta Was this translation helpful? Give feedback.
-
I know that the Passport-SAML has been well tested to work with Onelogin but I am facing an issue "Invalid signature", it might be my local configuration issue or may be OneLogin setup issue.
The application throws error
Invalid signature
at:/node_modules/passport-saml/lib/node-saml/saml.js:584:27
, When I open the file I come to know that this line belongs to functionvalidatePostResponseAsync
which callsvalidateSignature
for assertion.and the actual cause of error is:
for my SAML response, the
signatures.length
value was always0
.I don't know the reason of this behaviour.
Any help will be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions