Skip to content

fix: correct handling of XML entities in signature attributes - #221

Merged
cjbarth merged 1 commit into
node-saml:masterfrom
Marsup:fix/xml-entities-in-signature-attributes
Nov 17, 2022
Merged

fix: correct handling of XML entities in signature attributes#221
cjbarth merged 1 commit into
node-saml:masterfrom
Marsup:fix/xml-entities-in-signature-attributes

Conversation

@Marsup

@Marsup Marsup commented Nov 17, 2022

Copy link
Copy Markdown
Contributor

Description

Fixes #200.

XML entities, when included in signature elements (value and/or certificate) fail signature check, passing the XML node to xml-crypto instead of providing a string fixes the issue.

Checklist:

  • Issue Addressed: [X]
  • Link to SAML spec: [ ]
  • Tests included? [X]
  • Documentation updated? [ ]

@codecov

codecov Bot commented Nov 17, 2022

Copy link
Copy Markdown

Codecov Report

Merging #221 (c829eb3) into master (939879d) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #221      +/-   ##
==========================================
- Coverage   80.70%   80.68%   -0.03%     
==========================================
  Files          11       11              
  Lines         819      818       -1     
  Branches      251      251              
==========================================
- Hits          661      660       -1     
  Misses         68       68              
  Partials       90       90              
Impacted Files Coverage Δ
src/xml.ts 79.31% <100.00%> (-0.18%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@cjbarth

cjbarth commented Nov 17, 2022

Copy link
Copy Markdown
Collaborator

So, the presumption here is that the downstream signature validation will cover this case and we shouldn't be normalizing the signature at all. Correct?

@Marsup

Marsup commented Nov 17, 2022

Copy link
Copy Markdown
Contributor Author

We should be normalizing the signature (and only the signature) we provide through loadSignature, all paths that lead to this call appears to provide a node that comes out of parseDomFromString, so it is already normalized. This way we can keep fullXml the way it is. I guess another way to do it if you wanted to keep a string would be to normalize both \r and XML entities, but since you already have a normalized node, that seems like unnecessary work.

@cjbarth

cjbarth commented Nov 17, 2022

Copy link
Copy Markdown
Collaborator

Now that we have a test to make sure things continue working, we'll know if something else changes.

@cjbarth cjbarth added the bug Something isn't working label Nov 17, 2022
@cjbarth
cjbarth merged commit b1263c7 into node-saml:master Nov 17, 2022
@Marsup
Marsup deleted the fix/xml-entities-in-signature-attributes branch November 17, 2022 18:28
@jonathansamines

Copy link
Copy Markdown

Hey @cjbarth, any chance we can get these changes published? I am working on moving some projects from passport-saml to @node-saml/node-saml and this is currently the only problem we have found so far. I was able to locally verify these changes and they work for our integrations ;)

@cjbarth

cjbarth commented Nov 23, 2022

Copy link
Copy Markdown
Collaborator

Released @jonathansamines .

@jonathansamines

Copy link
Copy Markdown

awesome, thank you @cjbarth

@grundb

grundb commented Nov 24, 2022

Copy link
Copy Markdown

@cjbarth Great to see that you seem to have solved this problem! I noticed version 4.0.2 seems to be missing from npm, though: https://www.npmjs.com/package/@node-saml/passport-saml?activeTab=versions. Maybe you just haven't had time to publish it or something, but just letting you know 👍

@Marsup

Marsup commented Nov 24, 2022

Copy link
Copy Markdown
Contributor Author

He doesn't need to, the semver range is perfectly appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants