ARTREMIS-1703 disable listing in web console
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/5144fbb2 Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/5144fbb2 Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/5144fbb2 Branch: refs/heads/master Commit: 5144fbb24c9c431dcb36789c04d9e6214d0b63e0 Parents: 7596f0c Author: Stanislav Knot <[email protected]> Authored: Mon Feb 26 17:49:25 2018 +0100 Committer: Michael Andre Pearce <[email protected]> Committed: Mon Feb 26 17:43:43 2018 +0000 ---------------------------------------------------------------------- .../activemq-branding/src/main/resources/WEB-INF/web.xml | 6 ++++++ .../artemis-plugin/src/main/resources/WEB-INF/web.xml | 6 ++++++ .../apache/activemq/artemis/component/WebServerComponent.java | 3 ++- 3 files changed, 14 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5144fbb2/artemis-hawtio/activemq-branding/src/main/resources/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/artemis-hawtio/activemq-branding/src/main/resources/WEB-INF/web.xml b/artemis-hawtio/activemq-branding/src/main/resources/WEB-INF/web.xml index b9ba164..3fd8b74 100644 --- a/artemis-hawtio/activemq-branding/src/main/resources/WEB-INF/web.xml +++ b/artemis-hawtio/activemq-branding/src/main/resources/WEB-INF/web.xml @@ -48,6 +48,12 @@ <param-value>${plugin-scripts}</param-value> </context-param> + <context-param> + <description>Disable listing of directories and files</description> + <param-name>org.eclipse.jetty.servlet.Default.dirAllowed</param-name> + <param-value>false</param-value> + </context-param> + <listener> <listener-class>org.apache.activemq.hawtio.branding.PluginContextListener</listener-class> </listener> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5144fbb2/artemis-hawtio/artemis-plugin/src/main/resources/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/artemis-hawtio/artemis-plugin/src/main/resources/WEB-INF/web.xml b/artemis-hawtio/artemis-plugin/src/main/resources/WEB-INF/web.xml index b6c454e..a75489c 100644 --- a/artemis-hawtio/artemis-plugin/src/main/resources/WEB-INF/web.xml +++ b/artemis-hawtio/artemis-plugin/src/main/resources/WEB-INF/web.xml @@ -48,6 +48,12 @@ <param-value>${plugin-scripts}</param-value> </context-param> + <context-param> + <description>Disable listing of directories and files</description> + <param-name>org.eclipse.jetty.servlet.Default.dirAllowed</param-name> + <param-value>false</param-value> + </context-param> + <listener> <listener-class>org.apache.activemq.hawtio.plugin.PluginContextListener</listener-class> </listener> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5144fbb2/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java ---------------------------------------------------------------------- diff --git a/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java b/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java index d85d621..dedbcfd 100644 --- a/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java +++ b/artemis-web/src/main/java/org/apache/activemq/artemis/component/WebServerComponent.java @@ -110,7 +110,7 @@ public class WebServerComponent implements ExternalComponent { ResourceHandler resourceHandler = new ResourceHandler(); resourceHandler.setResourceBase(warDir.toString()); - resourceHandler.setDirectoriesListed(true); + resourceHandler.setDirectoriesListed(false); resourceHandler.setWelcomeFiles(new String[]{"index.html"}); DefaultHandler defaultHandler = new DefaultHandler(); @@ -120,6 +120,7 @@ public class WebServerComponent implements ExternalComponent { context.setContextPath("/"); context.setResourceBase(warDir.toString()); context.setHandler(resourceHandler); + context.setInitParameter("org.eclipse.jetty.servlet.Default.dirAllowed", "false"); handlers.addHandler(context); handlers.addHandler(defaultHandler);
