Skip to content

Commit ade8811

Browse files
authored
fix: use 2.16.0 log4j version and ban all 2.x versions which are < 2.16.0 (#3382)
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/java-bigtable-hbase/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #<issue_number_goes_here> ☕️
1 parent 109fb11 commit ade8811

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

bigtable-dataflow-parent/bigtable-beam-import/pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ limitations under the License.
169169
<artifactId>slf4j-api</artifactId>
170170
<version>${slf4j.version}</version>
171171
</dependency>
172+
<dependency>
173+
<groupId>org.apache.logging.log4j</groupId>
174+
<artifactId>log4j-api</artifactId>
175+
<version>${log4j2.version}</version>
176+
</dependency>
172177
<!-- https://mvnrepository.com/artifact/com.google.cloud.bigdataoss/gcs-connector -->
173178
<dependency>
174179
<groupId>com.google.cloud.bigdataoss</groupId>
@@ -398,6 +403,10 @@ limitations under the License.
398403
<usedDependency>org.apache.beam:beam-runners-direct-java
399404
</usedDependency>
400405
</usedDependencies>
406+
<ignoredUnusedDeclaredDependencies>
407+
<!-- log4j-api dependency is added to enforce log4j versions with CVE fixes -->
408+
<ignoredUnusedDeclaredDependency>org.apache.logging.log4j:log4j-api</ignoredUnusedDeclaredDependency>
409+
</ignoredUnusedDeclaredDependencies>
401410
</configuration>
402411
</plugin>
403412

bigtable-dataflow-parent/bigtable-hbase-beam/pom.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,11 @@ limitations under the License.
8282
<artifactId>slf4j-api</artifactId>
8383
<version>${slf4j.version}</version>
8484
</dependency>
85-
85+
<dependency>
86+
<groupId>org.apache.logging.log4j</groupId>
87+
<artifactId>log4j-api</artifactId>
88+
<version>${log4j2.version}</version>
89+
</dependency>
8690
<!-- TODO: remove this dependency when upgraded through transitive dependency (beam-sdks-java-core)
8791
this is not used directly, but upgrading due to transitive vulnerabilities in older versions-->
8892
<dependency>
@@ -247,6 +251,10 @@ limitations under the License.
247251
org.apache.beam:beam-sdks-java-io-hbase
248252
</usedDependency>
249253
</usedDependencies>
254+
<ignoredUnusedDeclaredDependencies>
255+
<!-- log4j-api dependency is added to enforce log4j versions with CVE fixes -->
256+
<ignoredUnusedDeclaredDependency>org.apache.logging.log4j:log4j-api</ignoredUnusedDeclaredDependency>
257+
</ignoredUnusedDeclaredDependencies>
250258
</configuration>
251259
</plugin>
252260
</plugins>

pom.xml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ limitations under the License.
6262
<slf4j.version>1.7.25</slf4j.version>
6363
<commons-logging.version>1.2</commons-logging.version>
6464
<jsr305.version>3.0.2</jsr305.version>
65+
<log4j2.version>2.16.0</log4j2.version>
6566

6667
<!-- hbase dependency versions -->
6768
<hbase.version.1>1.4.12</hbase.version.1>
@@ -262,6 +263,28 @@ limitations under the License.
262263
<groupId>org.apache.maven.plugins</groupId>
263264
<artifactId>maven-dependency-plugin</artifactId>
264265
</plugin>
266+
<plugin>
267+
<groupId>org.apache.maven.plugins</groupId>
268+
<artifactId>maven-enforcer-plugin</artifactId>
269+
<executions>
270+
<execution>
271+
<id>enforce-banned-deps</id>
272+
<goals>
273+
<goal>enforce</goal>
274+
</goals>
275+
<configuration>
276+
<rules>
277+
<!-- ban all log4j 2.x deps with CVEs -->
278+
<bannedDependencies>
279+
<excludes>
280+
<exclude>org.apache.logging.log4j:*:[2.0-alpha1,2.15.0]</exclude>
281+
</excludes>
282+
</bannedDependencies>
283+
</rules>
284+
</configuration>
285+
</execution>
286+
</executions>
287+
</plugin>
265288
</plugins>
266289
</build>
267290
</project>

0 commit comments

Comments
 (0)