-
Notifications
You must be signed in to change notification settings - Fork 175
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
duplicate reference in signature #165
Comments
UPDATE: turns out that the duplicated reference tags do not affect the SAML response whenever I send it out, but it occasionally duplicates too much to a point that it returns a 400 error (for being too long) |
Thanks for the details. Could you clarify the circumstances that lead to that (eg, are you calling |
Hi, sorry for the late reply. Here is an example payload that I am getting from my endpoint that is generating the SAML assertion. Here a snippet of a SAML assertion that throws an error on the service provider
What intrigues me is that the signing function that I have is only called once and this issue happens randomly (sometimes there's 5, sometimes there's only 1 and sometimes its this). |
Thanks for this. It is going to take me a while to try to reproduce this given time issues on my end, but I'll try to look into it. In the meantime, let me know if you have a small self-contained test case that reproduces this issue so that it's easier for me to debug. If you are also able to provide me the xml document that you were attempting to sign, that would be useful too. As a possible hint, the xpath you added as part of your reference will match all nodes whose local name is |
Inspection of section 5.4 of the core SAML spec suggests that there should only be one I am currently in favour of throwing an error if the xpath query returns more than one element, as I feel that the caller may not always expect the first element from the query to be the desired reference. This also encourages the caller to provide a more specific xpath, a good practice in keeping compliance with the spec. Wdyt? |
That sounds good! It kind of explains why the reference tag is returned multiple times, but it doesn't make any sense that the xpath in this case is finding multiple saml:Assertion tags as there is only one. Here is the syntax that I am currently using for the xpath..
|
Doesn't |
here's a sample payload that needs to be signed:
|
Thanks for the information. Given the duplicate URI attributes in the I could also switch from xpath.js to xpath, a better-maintained fork of the library. I'll then cut a minor release of xml-crypto and see how far you go with that, but that's far more involved and would take me some time to get out of the way. |
Converting to the xpath library would be a good idea. For the meantime, I can sandbox test the new xpath library with my sample payload. Thanks for the help and happy New Year! 🎉 |
1.1.1 of xml-crypto has been published, see if this addresses your problems |
I'm getting a weird bug where the reference tag is duplicated whenever my frontend calls the backend to generate a SAML assertion. It occasionally happens and breaks signature verification regardless if I trim the excess reference nodes . Can anyone point me in the right direction on how to resolve this?
Thanks.
Here is the code snippet that I have performing the xml signature. Let me know if I need to post more information.
The text was updated successfully, but these errors were encountered: