Skip to content

Commit 5f1e8b8

Browse files
committed
Java: update newSchemaFactory to the merged Commons XML 0.1.0 API
apache/commons-xml#32 replaced the no-argument newSchemaFactory() with newSchemaFactory(String schemaLanguage), without keeping an overload. Update the 0.1.0 stub and the XXE test accordingly, as suggested by Copilot. The QL model matches the method by name, so no query or library changes are needed. Assisted-By: Claude Fable 5 <noreply@anthropic.com>
1 parent dc16cbe commit 5f1e8b8

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

java/ql/test/query-tests/security/CWE-611/XmlFactoriesTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import java.net.Socket;
22

3+
import javax.xml.XMLConstants;
34
import javax.xml.parsers.DocumentBuilder;
45
import javax.xml.parsers.DocumentBuilderFactory;
56
import javax.xml.parsers.SAXParser;
@@ -56,7 +57,7 @@ public void hardenedTransformer(Socket sock) throws Exception {
5657
}
5758

5859
public void hardenedSchema(Socket sock) throws Exception {
59-
SchemaFactory factory = XmlFactories.newSchemaFactory();
60+
SchemaFactory factory = XmlFactories.newSchemaFactory(XMLConstants.W3C_XML_SCHEMA_NS_URI);
6061
Schema schema = factory.newSchema(new StreamSource(sock.getInputStream())); // safe
6162
}
6263
}

java/ql/test/stubs/apache-commons-xml-0.1.0/org/apache/commons/xml/XmlFactories.java

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)