gnodet-bot commented on code in PR #30555:
URL: https://github.com/apache/camel/pull/30555#discussion_r4652538388
##########
catalog/camel-catalog-cve/src/main/java/org/apache/camel/catalog/cve/DependencyChains.java:
##########
@@ -171,13 +171,37 @@ private static Path siblingPom(Path jarPath) {
return Files.isRegularFile(pom) ? pom : null;
}
+ // a POM is read with secure processing and without external entities
+ private static DocumentBuilderFactory createDocumentBuilderFactory() {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ factory.setIgnoringElementContentWhitespace(true);
+ factory.setIgnoringComments(true);
+ try {
+ factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING,
Boolean.TRUE);
+ } catch (ParserConfigurationException e) {
+ // not supported by this parser
+ }
+ try {
+
factory.setFeature("http://xml.org/sax/features/external-general-entities",
false);
+ } catch (ParserConfigurationException e) {
+ // not supported by this parser
+ }
+ try {
+
factory.setFeature("http://xml.org/sax/features/external-parameter-entities",
false);
+ } catch (ParserConfigurationException e) {
+ // not supported by this parser
+ }
+ return factory;
+ }
Review Comment:
Missing the Xerces `SecurityManager` defence-in-depth block that
`XmlHelper.createDocumentBuilderFactory()` includes (lines 58–67). The omission
is likely intentional (this module has no dependency on
`camel-util`/`ObjectHelper` for reflective class loading), but please add a
brief comment here explaining why the Xerces block was dropped, since the two
factory methods now diverge.
--
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]