You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "garydgregory (via GitHub)" <gi...@apache.org> on 2026/09/06 13:06:45 UTC
Re: [PR] Harden XML parsing via commons-secure-xml [commons-scxml]
garydgregory commented on code in PR #393:
URL: https://github.com/apache/commons-scxml/pull/393#discussion_r3944024287
##########
src/main/java/org/apache/commons/scxml2/io/ContentParser.java:
##########
@@ -224,7 +226,8 @@ public ParsedValue parseResource(final String resourceURL) throws IOException {
public Node parseXml(final String xmlString) throws IOException {
Document doc;
try {
- doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(xmlString);
+ // Wrap in an InputSource: DocumentBuilder.parse(String) would interpret the content as a URI.
+ doc = SecureDocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(xmlString)));
Review Comment:
@ppkarwasz
I think we need a unit test to validate this bug fix.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org