From 21aa27833011a3eea1d1ad79cfe3598a14d11c23 Mon Sep 17 00:00:00 2001 From: Nihal Jain Date: Mon, 4 Nov 2024 11:13:17 +0530 Subject: [PATCH] HBASE-28921 Avoid bundling hbase-webapps folder in default jars (#6388) We are bundling all webapp resources in hbase-server, hbase-thrift, hbase-rest and transitively to hbase-shaded-mapreduce jar. This can be an issue, say if any of the Js projects used by hbase are vulnerable, security scan tools like sonatype start flagging the jars too as vulnerable since they contain vulnerable code. With this JIRA, we want to avoid bundling static webapp resources in our jars as these are available during runtime via hbase-webapps directory bundled in our assembly. But, we still need this for our minicluster based tests which expects it to be present in test classpath. Hence, we are copying hbase-webapps to hbase-server tests jar, which contains class SingleProcessHBaseCluster responsible for hbase minicluster creation. This class eventually needs hbase-webapps in classpath during HttpServer initialisation and hence we are adding hbase-webapps to hbase-server test resources. Signed-off-by: Istvan Toth (cherry picked from commit 16c51d83ac980495b18d06e0b7480c665c99275b) --- hbase-rest/pom.xml | 9 +++++ hbase-server/pom.xml | 90 ++++++++++++++++++++++++++++++++++++-------- hbase-thrift/pom.xml | 9 +++++ 3 files changed, 93 insertions(+), 15 deletions(-) diff --git a/hbase-rest/pom.xml b/hbase-rest/pom.xml index 64ce0eb7746c..c57a896c8c0d 100644 --- a/hbase-rest/pom.xml +++ b/hbase-rest/pom.xml @@ -290,6 +290,15 @@ true + + org.apache.maven.plugins + maven-jar-plugin + + + **/hbase-webapps/** + + + maven-antrun-plugin diff --git a/hbase-server/pom.xml b/hbase-server/pom.xml index b81c1492af9e..eec2dd5ddd71 100644 --- a/hbase-server/pom.xml +++ b/hbase-server/pom.xml @@ -35,6 +35,7 @@ true true true + hbase-webapps @@ -449,24 +450,83 @@ true + + org.codehaus.mojo + build-helper-maven-plugin + + + add-test-source + + add-test-resource + + generate-test-sources + + + + + + target/${hbase.webapps.dir} + + ${hbase.webapps.dir} + + + + + + org.apache.maven.plugins maven-jar-plugin - - - - org/apache/jute/** - org/apache/zookeeper/** - **/*.jsp - hbase-site.xml - hdfs-site.xml - log4j.properties - mapred-queues.xml - mapred-site.xml - - + + + + default-jar + + jar + + package + + + + org/apache/jute/** + org/apache/zookeeper/** + **/*.jsp + hbase-site.xml + hdfs-site.xml + log4j.properties + mapred-queues.xml + mapred-site.xml + + **/hbase-webapps/** + + + + + + test-jar + + test-jar + + package + + tests + + org/apache/jute/** + org/apache/zookeeper/** + **/*.jsp + hbase-site.xml + hdfs-site.xml + log4j.properties + mapred-queues.xml + mapred-site.xml + + + + + diff --git a/hbase-thrift/pom.xml b/hbase-thrift/pom.xml index 0cd15bd48529..049ed345f939 100644 --- a/hbase-thrift/pom.xml +++ b/hbase-thrift/pom.xml @@ -203,6 +203,15 @@ true + + org.apache.maven.plugins + maven-jar-plugin + + + **/hbase-webapps/** + + + maven-antrun-plugin