You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by wu...@apache.org on 2022/11/14 16:39:08 UTC

[ambari] branch trunk updated: AMBARI-25390: Disable indexing in /resources endpoint and sub-directory (#3495)

This is an automated email from the ASF dual-hosted git repository.

wuzhiguo pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 0189283b4e AMBARI-25390: Disable indexing in /resources endpoint and sub-directory (#3495)
0189283b4e is described below

commit 0189283b4e9751f4d9469d80fff56d547429b838
Author: Zhiguo Wu <wu...@apache.org>
AuthorDate: Tue Nov 15 00:39:03 2022 +0800

    AMBARI-25390: Disable indexing in /resources endpoint and sub-directory (#3495)
---
 ambari-server/src/main/assemblies/server.xml            |  5 -----
 .../apache/ambari/server/controller/AmbariServer.java   |  1 +
 ambari-server/src/main/resources/index.html             | 17 -----------------
 3 files changed, 1 insertion(+), 22 deletions(-)

diff --git a/ambari-server/src/main/assemblies/server.xml b/ambari-server/src/main/assemblies/server.xml
index 33912d3b29..9f5c1aa163 100644
--- a/ambari-server/src/main/assemblies/server.xml
+++ b/ambari-server/src/main/assemblies/server.xml
@@ -407,11 +407,6 @@
       <source>src/main/resources/APACHE-AMBARI-MIB.txt</source>
       <outputDirectory>/var/lib/ambari-server/resources</outputDirectory>
     </file>
-    <file>
-      <fileMode>755</fileMode>
-      <source>src/main/resources/index.html</source>
-      <outputDirectory>/var/lib/ambari-server/resources</outputDirectory>
-    </file>
     <file>
       <fileMode>755</fileMode>
       <source>src/main/resources/kerberos.json</source>
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index 28c1863c8e..accdd97868 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -511,6 +511,7 @@ public class AmbariServer {
       File resourcesDirectory = new File(configs.getResourceDirPath());
       ServletHolder resources = new ServletHolder(DefaultServlet.class);
       resources.setInitParameter("resourceBase", resourcesDirectory.getParent());
+      resources.setInitParameter("dirAllowed", "false");
       root.addServlet(resources, "/resources/*");
       resources.setInitOrder(5);
 
diff --git a/ambari-server/src/main/resources/index.html b/ambari-server/src/main/resources/index.html
deleted file mode 100644
index 734b09496f..0000000000
--- a/ambari-server/src/main/resources/index.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
--->


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ambari.apache.org
For additional commands, e-mail: commits-help@ambari.apache.org