Skip to content

Commit

Permalink
limit transforms for signed node
Browse files Browse the repository at this point in the history
  • Loading branch information
pp-ps committed May 19, 2021
1 parent 683f767 commit 80e6fd6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/node-saml/saml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,19 @@ class SAML {
if (signatures.length !== 1) {
return false;
}
const xpathTransformQuery =
".//*[" +
"local-name(.)='Transform' and " +
"namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#' and " +
"ancestor::*[local-name(.)='Reference' and @URI='#" +
currentNode.getAttribute("ID") +
"']" +
"]";
const transforms = xpath.selectElements(currentNode, xpathTransformQuery);
// Reject also XMLDSIG with more than 2 Transform
if (transforms.length > 2) {
return false;
}

const signature = signatures[0];
return certs.some((certToCheck) => {
Expand Down

0 comments on commit 80e6fd6

Please sign in to comment.