garydgregory commented on code in PR #2635:
URL: https://github.com/apache/activemq/pull/2635#discussion_r4179103765
##########
activemq-broker/src/main/java/org/apache/activemq/util/XmlFactories.java:
##########
@@ -35,42 +35,11 @@ public final class XmlFactories {
private XmlFactories() { /* Do not instantiate */ }
public static DocumentBuilderFactory getSafeDocumentBuilderFactory() {
- DocumentBuilderFactory builderFactory =
DocumentBuilderFactory.newInstance();
-
- // See
https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.md#java
- trySetFeature(builderFactory, XMLConstants.FEATURE_SECURE_PROCESSING,
true);
-
trySetFeature(builderFactory,"http://apache.org/xml/features/disallow-doctype-decl",
true);
-
trySetFeature(builderFactory,"http://xml.org/sax/features/external-general-entities",
false);
-
trySetFeature(builderFactory,"http://xml.org/sax/features/external-parameter-entities",
false);
-
trySetFeature(builderFactory,"http://apache.org/xml/features/nonvalidating/load-external-dtd",
false);
-
- return builderFactory;
+ return SecureDocumentBuilderFactory.newInstance();
Review Comment:
I implemented @ppkarwasz 's suggestion in commit
6264883fc77692a3ae289cc257c008313d294e01.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact