davidzollo commented on code in PR #11250:
URL: https://github.com/apache/seatunnel/pull/11250#discussion_r3509591628
##########
seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/XmlReadStrategy.java:
##########
@@ -169,6 +186,25 @@ public void readProcess(
});
}
+ /**
+ * Configure the XML reader with XXE-safe defaults before parsing
user-controlled file contents.
+ */
+ private SAXReader createSecureSaxReader() {
+ SAXReader saxReader = new SAXReader();
+ try {
+ saxReader.setFeature(DISALLOW_DOCTYPE_DECL, true);
+ saxReader.setFeature(EXTERNAL_GENERAL_ENTITIES, false);
+ saxReader.setFeature(EXTERNAL_PARAMETER_ENTITIES, false);
+ saxReader.setFeature(LOAD_EXTERNAL_DTD, false);
Review Comment:
Added `XMLConstants.FEATURE_SECURE_PROCESSING` on top of the existing
`DOCTYPE` and external-entity hardening so JAXP secure-processing limits stay
enabled even when Xerces is on the classpath. I also reran `./mvnw -f
seatunnel-connectors-v2/connector-file/connector-file-base/pom.xml
spotless:apply` and `./mvnw -f
seatunnel-connectors-v2/connector-file/connector-file-base/pom.xml
-Dtest=XmlReadStrategyTest test` locally; both passed on the updated head.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]