Merge branch 'main' into atorralba/java/promote-xxe-experimental-sinks

This commit is contained in:
Tony Torralba
2023-05-16 09:49:34 +02:00
committed by GitHub
1736 changed files with 117920 additions and 89092 deletions

View File

@@ -26,4 +26,19 @@ public class XPathExpressionTests {
XPathExpression expr = path.compile("");
expr.evaluate(new InputSource(sock.getInputStream())); // $ hasTaintFlow
}
public void safeXPathEvaluateTest(Socket sock) throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
DocumentBuilder builder = factory.newDocumentBuilder();
XPathFactory xFactory = XPathFactory.newInstance();
XPath path = xFactory.newXPath();
path.evaluate("", builder.parse(sock.getInputStream())); // safe
}
public void unsafeXPathEvaluateTest(Socket sock) throws Exception {
XPathFactory xFactory = XPathFactory.newInstance();
XPath path = xFactory.newXPath();
path.evaluate("", new InputSource(sock.getInputStream())); // $ hasTaintFlow
}
}