AMQ-9771: Enable security features when building XML Schema in activemq-runtime-config. (#1498)
diff --git a/activemq-runtime-config/src/main/java/org/apache/activemq/plugin/RuntimeConfigurationBroker.java b/activemq-runtime-config/src/main/java/org/apache/activemq/plugin/RuntimeConfigurationBroker.java
index e0d3d80..b7342f4 100644
--- a/activemq-runtime-config/src/main/java/org/apache/activemq/plugin/RuntimeConfigurationBroker.java
+++ b/activemq-runtime-config/src/main/java/org/apache/activemq/plugin/RuntimeConfigurationBroker.java
@@ -228,8 +228,9 @@
private Schema getSchema() throws SAXException, IOException {
if (schema == null) {
- SchemaFactory schemaFactory = SchemaFactory.newInstance(
- XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ schemaFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
+ schemaFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
ArrayList<StreamSource> schemas = new ArrayList<StreamSource>();
schemas.add(new StreamSource(getClass().getResource("/activemq.xsd").toExternalForm()));