From 8b2774d14a0984da9ed6662ef275213e17b83a1b Mon Sep 17 00:00:00 2001 From: Nihal Jain Date: Wed, 23 Oct 2024 17:46:42 +0530 Subject: [PATCH 1/3] HBASE-28921 Skip bundling hbase-webapps folder in jars 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 copying it to hbase-server tests. --- hbase-rest/pom.xml | 9 +++++ hbase-server/pom.xml | 94 +++++++++++++++++++++++++++++++++++++------- hbase-thrift/pom.xml | 9 +++++ pom.xml | 4 +- 4 files changed, 99 insertions(+), 17 deletions(-) diff --git a/hbase-rest/pom.xml b/hbase-rest/pom.xml index cf629b62991a..734f8db0b5be 100644 --- a/hbase-rest/pom.xml +++ b/hbase-rest/pom.xml @@ -289,6 +289,15 @@ true + + org.apache.maven.plugins + maven-jar-plugin + + + **/hbase-webapps/** + + + org.apache.maven.plugins diff --git a/hbase-server/pom.xml b/hbase-server/pom.xml index 92b696d2feca..b633c0e23a89 100644 --- a/hbase-server/pom.xml +++ b/hbase-server/pom.xml @@ -35,6 +35,8 @@ true true true + target/hbase-webapps + target/test-classes/hbase-webapps @@ -437,24 +439,86 @@ true + + org.apache.maven.plugins + maven-resources-plugin + + + + copy-hbase-webapps-to-test + + copy-resources + + process-test-resources + + + ${test.classes.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 b75b288c8789..fd21b18db5cf 100644 --- a/hbase-thrift/pom.xml +++ b/hbase-thrift/pom.xml @@ -194,6 +194,15 @@ true + + org.apache.maven.plugins + maven-jar-plugin + + + **/hbase-webapps/** + + + maven-antrun-plugin diff --git a/pom.xml b/pom.xml index d121edadcb38..6059062e6910 100644 --- a/pom.xml +++ b/pom.xml @@ -803,9 +803,9 @@ false - + false - + false false From 57942b622e6f7cc2683a610471bc2b68e5b23d9b Mon Sep 17 00:00:00 2001 From: Nihal Jain Date: Thu, 24 Oct 2024 21:26:51 +0530 Subject: [PATCH 2/3] - Switch to build-helper-maven-plugin --- hbase-server/pom.xml | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/hbase-server/pom.xml b/hbase-server/pom.xml index b633c0e23a89..7a1176c261da 100644 --- a/hbase-server/pom.xml +++ b/hbase-server/pom.xml @@ -35,8 +35,7 @@ true true true - target/hbase-webapps - target/test-classes/hbase-webapps + hbase-webapps @@ -440,26 +439,23 @@ - org.apache.maven.plugins - maven-resources-plugin + org.codehaus.mojo + build-helper-maven-plugin - - copy-hbase-webapps-to-test + add-test-source - copy-resources + add-test-resource - process-test-resources + generate-test-sources - - ${test.classes.webapps.dir} + - - ${hbase.webapps.dir} - - **/* - + + target/${hbase.webapps.dir} + + ${hbase.webapps.dir} @@ -513,8 +509,8 @@ log4j.properties mapred-queues.xml mapred-site.xml - + From 434a3ed40c65e94146dda8f790d310291ce1661d Mon Sep 17 00:00:00 2001 From: Nihal Jain Date: Mon, 28 Oct 2024 11:56:43 +0530 Subject: [PATCH 3/3] - Revert dummy whitespace changes --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 6059062e6910..d121edadcb38 100644 --- a/pom.xml +++ b/pom.xml @@ -803,9 +803,9 @@ false - + false - + false false