Skip to content
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

Remove Signature element from the xml before verifying it #13

Open
zccmg opened this issue Mar 31, 2016 · 5 comments
Open

Remove Signature element from the xml before verifying it #13

zccmg opened this issue Mar 31, 2016 · 5 comments

Comments

@zccmg
Copy link

zccmg commented Mar 31, 2016

in the saml.js file you can see this code

sig.loadSignature(signature.toString());
return sig.checkSignature(xml);

if the signature element was not removed from the assertion the digest value will be different.
so the correct code will be

sig.loadSignature(signature.toString());
//remove the signature element
doc.removeChild(signature);
return sig.checkSignature(doc.toString());
@lmarkus
Copy link
Collaborator

lmarkus commented Mar 31, 2016

Is it?
I haven't touched this in ages, but I believe that you need to check against the complete document, and the underlying function handled that logic.

Have you tried it in production? And if so, can you send a PR?

On Mar 31, 2016, at 1:32 AM, zccaliDev <[email protected]mailto:[email protected]> wrote:

in the saml.js file you can see this code

sig.loadSignature(signature.toString());
return sig.checkSignature(xml);

if the signature element was not removed from the assertion the digest value will be different.
so the correct code will be

sig.loadSignature(signature.toString());
//remove the signature element
doc.removeChild(signature);
return sig.checkSignature(doc.toString());

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHubhttps://github.com//issues/13

@zccmg
Copy link
Author

zccmg commented Apr 16, 2016

Yes, I tried. it's working 100%.
I modified some other functionality, I will send the Pull

@lmarkus
Copy link
Collaborator

lmarkus commented Apr 16, 2016

👍

@markstos
Copy link
Contributor

markstos commented Aug 7, 2016

I think @zccaliDev may be referring to this part of the XML signature spec in 6.6.3 XPath Filtering

Each signature must omit itself from its own digest calculations, but it is also necessary to exclude the second signature element from the digest calculations of the first signature so that adding the second signature does not break the first signature.

@zccmg
Copy link
Author

zccmg commented Aug 8, 2016

May it look that, but when I debug the process of checking the Signature it won't remove the signature element and try to validate the data and it cause an error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants