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

Fix issue in case when namespace has no prefix #329

Merged
merged 1 commit into from
Jul 8, 2023
Merged

Fix issue in case when namespace has no prefix #329

merged 1 commit into from
Jul 8, 2023

Conversation

git9527
Copy link
Contributor

@git9527 git9527 commented Jul 6, 2023

No description provided.

@git9527
Copy link
Contributor Author

git9527 commented Jul 6, 2023

@cjbarth Please take a look

@cjbarth
Copy link
Contributor

cjbarth commented Jul 6, 2023

This is good, but let's get this PR against master first, once that is approved we can just pick the changes back to 3.x.

@git9527
Copy link
Contributor Author

git9527 commented Jul 6, 2023

yes, I've create a separate one: #330

@cjbarth cjbarth merged commit a31e7ff into node-saml:3.x Jul 8, 2023
@cjbarth cjbarth added the bug label Jul 8, 2023
@cjbarth cjbarth changed the title fix issue in case when namespace has no prefix Fix issue in case when namespace has no prefix Jul 8, 2023
@cjbarth
Copy link
Contributor

cjbarth commented Jul 11, 2023

@git9527 This PR broke the tests. I can't release 3.x until this gets resolved. I pulled a31e7ff, which is where this code landed on master and ran npm ci && npm test and it failed. The commit before worked fine.

@git9527
Copy link
Contributor Author

git9527 commented Jul 12, 2023

all test cases are pass in the check https://github.com/node-saml/xml-crypto/pull/330/checks on master branch, what's the error you get?

@cjbarth
Copy link
Contributor

cjbarth commented Jul 12, 2023

Here is what I get on the commit before your change:

chris@CB-SB3:~/code/xml-crypto$ git checkout be17c063957a11387007c3bd9076232e283a0734
Note: switching to 'be17c063957a11387007c3bd9076232e283a0734'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at be17c06 Bump @xmldom/xmldom (#333)
chris@CB-SB3:~/code/xml-crypto$ git status
HEAD detached at be17c06
nothing to commit, working tree clean
chris@CB-SB3:~/code/xml-crypto$ npm ci
npm WARN prepare removing existing node_modules/ before installation

> @cjbarth/[email protected] postinstall /home/chris/code/xml-crypto/node_modules/@cjbarth/github-release-notes
> node ./_postinstall.js


                    | ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ |
                          🙏  Thanks for downloading gren
                    | ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ |

Before you start:

    1. Generate a token with repo scope at this link: https://github.com/settings/tokens/new
    2. For every project, run gren init to create a config file (optional)
    3. Run gren help for more help or see https://github-tools.github.io/github-release-notes/

For any questions/issues, go here: https://github.com/github-tools/github-release-notes/issues

If you like gren, feel free to ⭐  it!


.:| ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ |:.



> [email protected] postinstall /home/chris/code/xml-crypto/node_modules/nodeunit/node_modules/ejs
> node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)

added 1023 packages in 15.281s
chris@CB-SB3:~/code/xml-crypto$ npm test

> [email protected] test /home/chris/code/xml-crypto
> nodeunit ./test/canonicalization-unit-tests.js ./test/c14nWithComments-unit-tests.js ./test/signature-unit-tests.js ./test/saml-response-test.js ./test/signature-integration-tests.js ./test/document-test.js ./test/wsfed-metadata-test.js ./test/hmac-tests.js ./test/c14n-non-exclusive-unit-test.js


canonicalization-unit-tests.js
✔ Exclusive canonicalization works on xml with no namespaces
✔ Exclusive canonicalization works on inner xpath
✔ Exclusive canonicalization works on xml with prefixed namespaces defined in output nodes
✔ element used prefixed ns which is also the default
✔ Exclusive canonicalization works with default namespace for prefix
✔ Exclusive canonicalization works on xml with prefixed namespaces defined in output nodes. ns definition is not duplicated on each usage
✔ Exclusive canonicalization works on xml with prefixed namespaces defined in output nodes but before used
✔ Exclusive canonicalization works on xml with prefixed namespaces defined outside output nodes
✔ Exclusive canonicalization works on xml with prefixed namespace defined in inclusive list
✔ Exclusive canonicalization works on xml with multiple prefixed namespaces defined in inclusive list
✔ Exclusive canonicalization works on xml with prefixed namespace defined in inclusive list defined outside output nodes
✔ Exclusive canonicalization works on xml with prefixed namespace defined in inclusive list used on attribute
✔ Exclusive canonicalization works on xml with default namespace inside output nodes
✔ Exclusive canonicalization works on xml with multiple different default namespaces
✔ Exclusive canonicalization works on xml with multiple similar default namespaces
✔ Exclusive canonicalization works on xml with default namespace outside output nodes
✔ Exclusive canonicalization works when prefixed namespace is defined in output nodes not in the parent chain of who needs it
✔ Exclusive canonicalization works on xml with unordered attributes
✔ Exclusive canonicalization sorts upper case attributes before lower case
✔ Exclusive canonicalization removes Comments
✔ Exclusive canonicalization works on xml with attributes with different namespace than element
✔ Exclusive canonicalization works on xml with attribute values with special characters
✔ Exclusive canonicalization does not normalize whitespace characters into single spaces
✔ Exclusive canonicalization works on xml with element values with special characters
✔ Exclusive canonicalization preserves white space in values
✔ Exclusive canonicalization does not alter CR-NL (windows line separator) sequences
✔ Exclusive canonicalization preserves and encodes CR white space
✔ Exclusive canonicalization preserves white space between elements
✔ Exclusive canonicalization turns empty element to start-end tag pairs
✔ Exclusive canonicalization preserves empty start-end tag pairs
✔ Exclusive canonicalization with empty default namespace outside output nodes
✔ Exclusive canonicalization with empty default namespace inside output nodes
✔ The XML declaration and document type declaration (DTD) are removed
✔ Attribute value delimiters are set to quotation marks (double quotes)
✔ CDATA sections are replaced with their character content
✔ SignedInfo canonization
✔ Exclusive canonicalization works on complex xml
✔ Multiple Canonicalization with namespace definition outside of signed element
✔ Enveloped-signature canonicalization respects currentnode
✔ The XML canonicalization method processes a node-set by imposing the following additional document order rules on the namespace and attribute nodes of each element:   - An element's namespace and attribute nodes have a document order position greater than the element but less than any child node of the element.     Namespace nodes have a lesser document order position than attribute nodes.   - An element's namespace nodes are sorted lexicographically by local name (the default namespace node, if one exists, has no local name and is therefore lexicographically least).   - An element's attribute nodes are sorted lexicographically with namespace URI as the primary key and local name as the secondary key (an empty namespace URI is lexicographically least).     Lexicographic comparison, which orders strings from least to greatest alphabetically, is based on the UCS codepoint values, which is equivalent to lexicographic ordering based on UTF-8.
✔ saml attributed order (bug #25)
✔ Body Xml Element Canonicalization
✔ Overriding namespace in canonicalization

c14nWithComments-unit-tests.js
✔ Exclusive canonicalization works on xml with no namespaces
✔ Exclusive canonicalization works on inner xpath
✔ Exclusive canonicalization works on xml with prefixed namespaces defined in output nodes
✔ element used prefixed ns which is also the default
✔ Exclusive canonicalization works on xml with prefixed namespaces defined in output nodes. ns definition is not duplicated on each usage
✔ Exclusive canonicalization works on xml with prefixed namespaces defined in output nodes but before used
✔ Exclusive canonicalization works on xml with prefixed namespaces defined outside output nodes
✔ Exclusive canonicalization works on xml with prefixed namespace defined in inclusive list
✔ Exclusive canonicalization works on xml with multiple prefixed namespaces defined in inclusive list
✔ Exclusive canonicalization works on xml with prefixed namespace defined in inclusive list defined outside output nodes
✔ Exclusive canonicalization works on xml with prefixed namespace defined in inclusive list used on attribute
✔ Exclusive canonicalization works on xml with default namespace inside output nodes
✔ Exclusive canonicalization works on xml with multiple different default namespaces
✔ Exclusive canonicalization works on xml with multiple similar default namespaces
✔ Exclusive canonicalization works on xml with default namespace outside output nodes
✔ Exclusive canonicalization works when prefixed namespace is defined in output nodes not in the parent chain of who needs it
✔ Exclusive canonicalization works on xml with unordered attributes
✔ Exclusive canonicalization sorts upper case attributes before lower case
✔ C14N#WithComments retains Comments
✔ Exclusive canonicalization works on xml with attributes with different namespace than element
✔ Exclusive canonicalization works on xml with attribute and element values with special characters
✔ Exclusive canonicalization preserves white space in values
✔ Exclusive canonicalization preserves white space between elements
✔ Exclusive canonicalization turns empty element to start-end tag pairs
✔ Exclusive canonicalization preserves empty start-end tag pairs
✔ Exclusive canonicalization with empty default namespace outside output nodes
✔ Exclusive canonicalization with empty default namespace inside output nodes
✔ The XML declaration and document type declaration (DTD) are removed
✔ Attribute value delimiters are set to quotation marks (double quotes)
✔ CDATA sections are replaced with their character content
✔ SignedInfo canonization
✔ Exclusive canonicalization works on complex xml
✔ Multiple Canonicalization with namespace definition outside of signed element
✔ Enveloped-signature canonicalization respects currentnode
✔ The XML canonicalization method processes a node-set by imposing the following additional document order rules on the namespace and attribute nodes of each element:   - An element's namespace and attribute nodes have a document order position greater than the element but less than any child node of the element.     Namespace nodes have a lesser document order position than attribute nodes.   - An element's namespace nodes are sorted lexicographically by local name (the default namespace node, if one exists, has no local name and is therefore lexicographically least).   - An element's attribute nodes are sorted lexicographically with namespace URI as the primary key and local name as the secondary key (an empty namespace URI is lexicographically least).     Lexicographic comparison, which orders strings from least to greatest alphabetically, is based on the UCS codepoint values, which is equivalent to lexicographic ordering based on UTF-8.
✔ saml attributed order (bug #25)

signature-unit-tests.js
✔ signer adds increasing id attributes to elements
✔ signer adds references with namespaces
✔ signer does not duplicate existing id attributes
✔ signer adds custom attributes to the signature root node
✔ signer appends signature to the root node by default
✔ signer appends signature to a reference node
✔ signer prepends signature to a reference node
✔ signer inserts signature before a reference node
✔ signer inserts signature after a reference node
✔ signer creates signature with correct structure
✔ signer creates signature with correct structure (with prefix)
✔ signer creates correct signature values
✔ signer creates correct signature values using async callback
✔ correctly loads signature
✔ verify valid signature
✔ fail invalid signature
✔ allow empty reference uri when signing
✔ signer appends signature to a non-existing reference node
✔ signer adds existing prefixes
✔ creates InclusiveNamespaces element when inclusiveNamespacesPrefixList is set on Reference
✔ does not create InclusiveNamespaces element when inclusiveNamespacesPrefixList is not set on Reference
✔ creates InclusiveNamespaces element inside CanonicalizationMethod when inclusiveNamespacesPrefixList is set on SignedXml options
✔ does not create InclusiveNamespaces element inside CanonicalizationMethod when inclusiveNamespacesPrefixList is not set on SignedXml options
✔ adds attributes to KeyInfo element when attrs are present in keyInfoProvider

saml-response-test.js
✔ test validating SAML response
✔ test validating wrapped assertion signature
✔ test validating SAML response where a namespace is defined outside the signed element
✔ test reference id does not contain quotes
✔ test validating SAML response WithComments

signature-integration-tests.js
✔ verify signature
✔ verify signature of complex element
✔ empty URI reference should consider the whole document
✔ add canonicalization if output of transforms will be a node-set rather than an octet stream
✔ signature with inclusive namespaces
✔ signature with inclusive namespaces with unix line separators
✔ signature with inclusive namespaces with windows line separators
✔ should create single root xml document when signing inner node

document-test.js
✔ test with a document (using FileKeyInfo)
✔ test with a document (using StringKeyInfo)

wsfed-metadata-test.js
✔ test validating WS-Fed Metadata

hmac-tests.js
✔ test validating HMAC signature
✔ test HMAC signature with incorrect key
✔ test create and validate HMAC signature

c14n-non-exclusive-unit-test.js
✔ findAncestorNs: Correctly picks up root ancestor namespace
✔ findAncestorNs: Correctly picks up intermediate ancestor namespace
✔ findAncestorNs: Correctly picks up multiple ancestor namespaces declared in the one same element
✔ findAncestorNs: Correctly picks up multiple ancestor namespaces scattered among depth
✔ findAncestorNs: Correctly picks up multiple ancestor namespaces without duplicate
✔ findAncestorNs: Correctly eliminates duplicate prefix
✔ findAncestorNs: Exclude namespace which is already declared with same prefix on target node
✔ findAncestorNs: Ignores namespace declared in the target xpath node
✔ C14n: Correctly picks up root ancestor namespace
✔ C14n: Correctly picks up intermediate ancestor namespace
✔ C14n: Correctly picks up multiple ancestor namespaces declared in the one same element
✔ C14n: Correctly picks up multiple ancestor namespaces scattered among depth
✔ C14n: Correctly picks up multiple ancestor namespaces without duplicate
✔ C14n: Correctly eliminates duplicate prefix
✔ C14n: Exclude namespace which is already declared with same prefix on target node
✔ C14n: Preserve namespace declared in the target xpath node
✔ C14n: Don't redeclare an attribute's namespace prefix if already in scope
✔ C14n: Don't declare an attribute's namespace prefix if in scope from parent

OK: 232 assertions (571ms)

And here is what I get when I checkout the next commit in master, which is the one with your change:

chris@CB-SB3:~/code/xml-crypto$ git checkout a31e7ff30822b6fc81c584ce4b13951e4d81458b
Previous HEAD position was be17c06 Bump @xmldom/xmldom (#333)
HEAD is now at a31e7ff Fix issue in case when namespace has no prefix (#329)
chris@CB-SB3:~/code/xml-crypto$ git status
HEAD detached at a31e7ff
nothing to commit, working tree clean
chris@CB-SB3:~/code/xml-crypto$ npm ci
npm WARN prepare removing existing node_modules/ before installation

> @cjbarth/[email protected] postinstall /home/chris/code/xml-crypto/node_modules/@cjbarth/github-release-notes
> node ./_postinstall.js


                    | ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ |
                          🙏  Thanks for downloading gren
                    | ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ |

Before you start:

    1. Generate a token with repo scope at this link: https://github.com/settings/tokens/new
    2. For every project, run gren init to create a config file (optional)
    3. Run gren help for more help or see https://github-tools.github.io/github-release-notes/

For any questions/issues, go here: https://github.com/github-tools/github-release-notes/issues

If you like gren, feel free to ⭐  it!


.:| ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ |:.



> [email protected] postinstall /home/chris/code/xml-crypto/node_modules/nodeunit/node_modules/ejs
> node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)

added 1023 packages in 14.787s
chris@CB-SB3:~/code/xml-crypto$ npm test

> [email protected] test /home/chris/code/xml-crypto
> nodeunit ./test/canonicalization-unit-tests.js ./test/c14nWithComments-unit-tests.js ./test/signature-unit-tests.js ./test/saml-response-test.js ./test/signature-integration-tests.js ./test/document-test.js ./test/wsfed-metadata-test.js ./test/hmac-tests.js ./test/c14n-non-exclusive-unit-test.js


canonicalization-unit-tests.js
✔ Exclusive canonicalization works on xml with no namespaces
✔ Exclusive canonicalization works on inner xpath
✔ Exclusive canonicalization works on xml with prefixed namespaces defined in output nodes
✔ element used prefixed ns which is also the default
✔ Exclusive canonicalization works with default namespace for prefix
✔ Exclusive canonicalization works on xml with prefixed namespaces defined in output nodes. ns definition is not duplicated on each usage
✔ Exclusive canonicalization works on xml with prefixed namespaces defined in output nodes but before used
✔ Exclusive canonicalization works on xml with prefixed namespaces defined outside output nodes
✔ Exclusive canonicalization works on xml with prefixed namespace defined in inclusive list
✔ Exclusive canonicalization works on xml with multiple prefixed namespaces defined in inclusive list
✔ Exclusive canonicalization works on xml with prefixed namespace defined in inclusive list defined outside output nodes
✔ Exclusive canonicalization works on xml with prefixed namespace defined in inclusive list used on attribute
✔ Exclusive canonicalization works on xml with default namespace inside output nodes
✔ Exclusive canonicalization works on xml with multiple different default namespaces
✔ Exclusive canonicalization works on xml with multiple similar default namespaces
✔ Exclusive canonicalization works on xml with default namespace outside output nodes
✔ Exclusive canonicalization works when prefixed namespace is defined in output nodes not in the parent chain of who needs it
✔ Exclusive canonicalization works on xml with unordered attributes
✔ Exclusive canonicalization sorts upper case attributes before lower case
✔ Exclusive canonicalization removes Comments
✔ Exclusive canonicalization works on xml with attributes with different namespace than element
✔ Exclusive canonicalization works on xml with attribute values with special characters
✔ Exclusive canonicalization does not normalize whitespace characters into single spaces
✔ Exclusive canonicalization works on xml with element values with special characters
✔ Exclusive canonicalization preserves white space in values
✔ Exclusive canonicalization does not alter CR-NL (windows line separator) sequences
✔ Exclusive canonicalization preserves and encodes CR white space
✔ Exclusive canonicalization preserves white space between elements
✔ Exclusive canonicalization turns empty element to start-end tag pairs
✔ Exclusive canonicalization preserves empty start-end tag pairs
✔ Exclusive canonicalization with empty default namespace outside output nodes
✔ Exclusive canonicalization with empty default namespace inside output nodes
✔ The XML declaration and document type declaration (DTD) are removed
✔ Attribute value delimiters are set to quotation marks (double quotes)
✔ CDATA sections are replaced with their character content
✔ SignedInfo canonization
✔ Exclusive canonicalization works on complex xml
✔ Multiple Canonicalization with namespace definition outside of signed element
✔ Enveloped-signature canonicalization respects currentnode
✔ The XML canonicalization method processes a node-set by imposing the following additional document order rules on the namespace and attribute nodes of each element:   - An element's namespace and attribute nodes have a document order position greater than the element but less than any child node of the element.     Namespace nodes have a lesser document order position than attribute nodes.   - An element's namespace nodes are sorted lexicographically by local name (the default namespace node, if one exists, has no local name and is therefore lexicographically least).   - An element's attribute nodes are sorted lexicographically with namespace URI as the primary key and local name as the secondary key (an empty namespace URI is lexicographically least).     Lexicographic comparison, which orders strings from least to greatest alphabetically, is based on the UCS codepoint values, which is equivalent to lexicographic ordering based on UTF-8.
✔ saml attributed order (bug #25)
✔ Body Xml Element Canonicalization
✔ Overriding namespace in canonicalization

c14nWithComments-unit-tests.js
✔ Exclusive canonicalization works on xml with no namespaces
✔ Exclusive canonicalization works on inner xpath
✔ Exclusive canonicalization works on xml with prefixed namespaces defined in output nodes
✔ element used prefixed ns which is also the default
✔ Exclusive canonicalization works on xml with prefixed namespaces defined in output nodes. ns definition is not duplicated on each usage
✔ Exclusive canonicalization works on xml with prefixed namespaces defined in output nodes but before used
✔ Exclusive canonicalization works on xml with prefixed namespaces defined outside output nodes
✔ Exclusive canonicalization works on xml with prefixed namespace defined in inclusive list
✔ Exclusive canonicalization works on xml with multiple prefixed namespaces defined in inclusive list
✔ Exclusive canonicalization works on xml with prefixed namespace defined in inclusive list defined outside output nodes
✔ Exclusive canonicalization works on xml with prefixed namespace defined in inclusive list used on attribute
✔ Exclusive canonicalization works on xml with default namespace inside output nodes
✔ Exclusive canonicalization works on xml with multiple different default namespaces
✔ Exclusive canonicalization works on xml with multiple similar default namespaces
✔ Exclusive canonicalization works on xml with default namespace outside output nodes
✔ Exclusive canonicalization works when prefixed namespace is defined in output nodes not in the parent chain of who needs it
✔ Exclusive canonicalization works on xml with unordered attributes
✔ Exclusive canonicalization sorts upper case attributes before lower case
✔ C14N#WithComments retains Comments
✔ Exclusive canonicalization works on xml with attributes with different namespace than element
✔ Exclusive canonicalization works on xml with attribute and element values with special characters
✔ Exclusive canonicalization preserves white space in values
✔ Exclusive canonicalization preserves white space between elements
✔ Exclusive canonicalization turns empty element to start-end tag pairs
✔ Exclusive canonicalization preserves empty start-end tag pairs
✔ Exclusive canonicalization with empty default namespace outside output nodes
✔ Exclusive canonicalization with empty default namespace inside output nodes
✔ The XML declaration and document type declaration (DTD) are removed
✔ Attribute value delimiters are set to quotation marks (double quotes)
✔ CDATA sections are replaced with their character content
✔ SignedInfo canonization
✔ Exclusive canonicalization works on complex xml
✔ Multiple Canonicalization with namespace definition outside of signed element
✔ Enveloped-signature canonicalization respects currentnode
✔ The XML canonicalization method processes a node-set by imposing the following additional document order rules on the namespace and attribute nodes of each element:   - An element's namespace and attribute nodes have a document order position greater than the element but less than any child node of the element.     Namespace nodes have a lesser document order position than attribute nodes.   - An element's namespace nodes are sorted lexicographically by local name (the default namespace node, if one exists, has no local name and is therefore lexicographically least).   - An element's attribute nodes are sorted lexicographically with namespace URI as the primary key and local name as the secondary key (an empty namespace URI is lexicographically least).     Lexicographic comparison, which orders strings from least to greatest alphabetically, is based on the UCS codepoint values, which is equivalent to lexicographic ordering based on UTF-8.
✔ saml attributed order (bug #25)

signature-unit-tests.js
✔ signer adds increasing id attributes to elements
✔ signer adds references with namespaces
✔ signer does not duplicate existing id attributes
✔ signer adds custom attributes to the signature root node
✔ signer appends signature to the root node by default
✔ signer appends signature to a reference node
✔ signer prepends signature to a reference node
✔ signer inserts signature before a reference node
✔ signer inserts signature after a reference node
✔ signer creates signature with correct structure
✔ signer creates signature with correct structure (with prefix)
✔ signer creates correct signature values
✔ signer creates correct signature values using async callback
✔ correctly loads signature
✔ verify valid signature
✔ fail invalid signature
✔ allow empty reference uri when signing
✔ signer appends signature to a non-existing reference node
✔ signer adds existing prefixes
✔ creates InclusiveNamespaces element when inclusiveNamespacesPrefixList is set on Reference
✔ does not create InclusiveNamespaces element when inclusiveNamespacesPrefixList is not set on Reference
✔ creates InclusiveNamespaces element inside CanonicalizationMethod when inclusiveNamespacesPrefixList is set on SignedXml options
✔ does not create InclusiveNamespaces element inside CanonicalizationMethod when inclusiveNamespacesPrefixList is not set on SignedXml options
✔ adds attributes to KeyInfo element when attrs are present in keyInfoProvider

saml-response-test.js
✔ test validating SAML response
✔ test validating wrapped assertion signature
✔ test validating SAML response where a namespace is defined outside the signed element
✔ test reference id does not contain quotes
✔ test validating SAML response WithComments

signature-integration-tests.js
✔ verify signature
✔ verify signature of complex element
✔ empty URI reference should consider the whole document
✔ add canonicalization if output of transforms will be a node-set rather than an octet stream
✔ signature with inclusive namespaces
✔ signature with inclusive namespaces with unix line separators
✔ signature with inclusive namespaces with windows line separators
✔ should create single root xml document when signing inner node

document-test.js
✔ test with a document (using FileKeyInfo)
✔ test with a document (using StringKeyInfo)

wsfed-metadata-test.js
✔ test validating WS-Fed Metadata

hmac-tests.js
✔ test validating HMAC signature
✔ test HMAC signature with incorrect key
✔ test create and validate HMAC signature

c14n-non-exclusive-unit-test.js
✔ findAncestorNs: Correctly picks up root ancestor namespace
✔ findAncestorNs: Correctly picks up intermediate ancestor namespace
✔ findAncestorNs: Correctly picks up multiple ancestor namespaces declared in the one same element
✔ findAncestorNs: Correctly picks up multiple ancestor namespaces scattered among depth
✔ findAncestorNs: Correctly picks up multiple ancestor namespaces without duplicate
✔ findAncestorNs: Correctly eliminates duplicate prefix
✔ findAncestorNs: Exclude namespace which is already declared with same prefix on target node
✖ findAncestorNs: Should not find namespace when both has no prefix

Error: XPath parse error
    at XPathParser.parse (/home/chris/code/xml-crypto/node_modules/xpath/xpath.js:1278:27)
    at new XPathExpression (/home/chris/code/xml-crypto/node_modules/xpath/xpath.js:4341:24)
    at Object.exports.selectWithResolver (/home/chris/code/xml-crypto/node_modules/xpath/xpath.js:4818:26)
    at findAncestorNs (/home/chris/code/xml-crypto/lib/signed-xml.js:190:25)
    at test_findAncestorNs (/home/chris/code/xml-crypto/test/c14n-non-exclusive-unit-test.js:22:16)
    at Object.exports.findAncestorNs: Should not find namespace when both has no prefix (/home/chris/code/xml-crypto/test/c14n-non-exclusive-unit-test.js:103:3)
    at Object.<anonymous> (/home/chris/code/xml-crypto/node_modules/nodeunit/lib/core.js:236:16)
    at /home/chris/code/xml-crypto/node_modules/nodeunit/lib/core.js:236:16
    at Object.exports.runTest (/home/chris/code/xml-crypto/node_modules/nodeunit/lib/core.js:70:9)
    at /home/chris/code/xml-crypto/node_modules/nodeunit/lib/core.js:118:25

✖ findAncestorNs: Should find namespace without prefix

Error: XPath parse error
    at XPathParser.parse (/home/chris/code/xml-crypto/node_modules/xpath/xpath.js:1278:27)
    at new XPathExpression (/home/chris/code/xml-crypto/node_modules/xpath/xpath.js:4341:24)
    at Object.exports.selectWithResolver (/home/chris/code/xml-crypto/node_modules/xpath/xpath.js:4818:26)
    at findAncestorNs (/home/chris/code/xml-crypto/lib/signed-xml.js:190:25)
    at test_findAncestorNs (/home/chris/code/xml-crypto/test/c14n-non-exclusive-unit-test.js:22:16)
    at Object.exports.findAncestorNs: Should find namespace without prefix (/home/chris/code/xml-crypto/test/c14n-non-exclusive-unit-test.js:112:3)
    at Object.<anonymous> (/home/chris/code/xml-crypto/node_modules/nodeunit/lib/core.js:236:16)
    at /home/chris/code/xml-crypto/node_modules/nodeunit/lib/core.js:236:16
    at Object.exports.runTest (/home/chris/code/xml-crypto/node_modules/nodeunit/lib/core.js:70:9)
    at /home/chris/code/xml-crypto/node_modules/nodeunit/lib/core.js:118:25

✔ findAncestorNs: Ignores namespace declared in the target xpath node
✔ C14n: Correctly picks up root ancestor namespace
✔ C14n: Correctly picks up intermediate ancestor namespace
✔ C14n: Correctly picks up multiple ancestor namespaces declared in the one same element
✔ C14n: Correctly picks up multiple ancestor namespaces scattered among depth
✔ C14n: Correctly picks up multiple ancestor namespaces without duplicate
✔ C14n: Correctly eliminates duplicate prefix
✔ C14n: Exclude namespace which is already declared with same prefix on target node
✔ C14n: Preserve namespace declared in the target xpath node
✔ C14n: Don't redeclare an attribute's namespace prefix if already in scope
✔ C14n: Don't declare an attribute's namespace prefix if in scope from parent
✔ C14n: should not has colon when parent namespace has no prefix

FAILURES: 2/235 assertions failed (572ms)
npm ERR! Test failed.  See above for more details.

@git9527
Copy link
Contributor Author

git9527 commented Jul 13, 2023

@cjbarth Fixed in #338

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

Successfully merging this pull request may close these issues.

2 participants