Skip to content

Commit 3b21ac6

Browse files
authored
GEODE-10543: Upgrade Log4j from 2.17.2 to 2.25.3 to remediate CVE-202… (#7975)
* GEODE-10543: Upgrade Log4j from 2.17.2 to 2.25.3 to remediate CVE-2025-68161 - Updated log4j version to 2.25.3 in DependencyConstraints.groovy - Added log4j-core-test dependency for integration tests - Migrated integration test imports to new log4j-core-test package structure: * org.apache.logging.log4j.junit → org.apache.logging.log4j.core.test.junit * org.apache.logging.log4j.test → org.apache.logging.log4j.core.test - Added GraalVM annotation processor configuration to suppress compilation warnings - Updated documentation references to log4j 2.25.3 - Updated test resource files with new JAR versions All 21 integration tests migrated with zero logic changes. Build successful with all tests passing. * GEODE-10543: Fix GraalVM annotation processor options to apply only to main compilation The annotation processor options were being applied to all JavaCompile tasks including integration tests, where the Log4j GraalVM processor is not triggered. This caused compilation warnings about unrecognized processor options. Changed from tasks.withType(JavaCompile) to tasks.named('compileJava') to restrict the configuration to main source compilation only. * GEODE-10543: Exclude AssertJ 3.27.3 from log4j-core-test to prevent NoSuchMethodError Log4j 2.25.3's log4j-core-test transitively depends on AssertJ 3.27.3, but Geode's custom AssertJ assertions (AbstractLogFileAssert) were built against AssertJ 3.22.0. The CommonValidations.failIfEmptySinceActualIsNotEmpty method signature changed between versions, causing NoSuchMethodError at runtime. Exclude assertj-core from log4j-core-test dependency to force usage of 3.22.0, ensuring binary compatibility with Geode's test infrastructure.
1 parent b0b2dab commit 3b21ac6

31 files changed

Lines changed: 87 additions & 61 deletions

File tree

boms/geode-all-bom/src/test/resources/expected-pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -530,27 +530,27 @@
530530
<dependency>
531531
<groupId>org.apache.logging.log4j</groupId>
532532
<artifactId>log4j-api</artifactId>
533-
<version>2.17.2</version>
533+
<version>2.25.3</version>
534534
</dependency>
535535
<dependency>
536536
<groupId>org.apache.logging.log4j</groupId>
537537
<artifactId>log4j-core</artifactId>
538-
<version>2.17.2</version>
538+
<version>2.25.3</version>
539539
</dependency>
540540
<dependency>
541541
<groupId>org.apache.logging.log4j</groupId>
542542
<artifactId>log4j-jcl</artifactId>
543-
<version>2.17.2</version>
543+
<version>2.25.3</version>
544544
</dependency>
545545
<dependency>
546546
<groupId>org.apache.logging.log4j</groupId>
547547
<artifactId>log4j-jul</artifactId>
548-
<version>2.17.2</version>
548+
<version>2.25.3</version>
549549
</dependency>
550550
<dependency>
551551
<groupId>org.apache.logging.log4j</groupId>
552552
<artifactId>log4j-slf4j-impl</artifactId>
553-
<version>2.17.2</version>
553+
<version>2.25.3</version>
554554
</dependency>
555555
<dependency>
556556
<groupId>org.apache.lucene</groupId>

build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraints.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class DependencyConstraints {
4646
deps.put("jakarta.annotation.version", "2.1.1")
4747
deps.put("jakarta.ejb.version", "4.0.1")
4848
deps.put("jgroups.version", "3.6.20.Final")
49-
deps.put("log4j.version", "2.17.2")
49+
deps.put("log4j.version", "2.25.3")
5050
deps.put("log4j-slf4j2-impl.version", "2.23.1")
5151
deps.put("micrometer.version", "1.14.0")
5252
deps.put("shiro.version", "1.13.0")
@@ -258,6 +258,7 @@ class DependencyConstraints {
258258
dependencySet(group: 'org.apache.logging.log4j', version: get('log4j.version')) {
259259
entry('log4j-api')
260260
entry('log4j-core')
261+
entry('log4j-core-test')
261262
entry('log4j-jcl')
262263
entry('log4j-jul')
263264
entry('log4j-slf4j-impl')

geode-assembly/src/acceptanceTest/resources/gradle-test-projects/management/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ repositories {
2525

2626
dependencies {
2727
implementation("${project.group}:geode-core:${project.version}")
28-
runtimeOnly('org.apache.logging.log4j:log4j-slf4j-impl:2.17.2')
28+
runtimeOnly('org.apache.logging.log4j:log4j-slf4j-impl:2.25.3')
2929
}
3030

3131
application {

geode-assembly/src/integrationTest/resources/assembly_content.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,11 +1012,11 @@ lib/jna-platform-5.11.0.jar
10121012
lib/joda-time-2.12.7.jar
10131013
lib/jopt-simple-5.0.4.jar
10141014
lib/jul-to-slf4j-2.0.16.jar
1015-
lib/log4j-api-2.17.2.jar
1016-
lib/log4j-core-2.17.2.jar
1017-
lib/log4j-jcl-2.17.2.jar
1018-
lib/log4j-jul-2.17.2.jar
1019-
lib/log4j-slf4j-impl-2.17.2.jar
1015+
lib/log4j-api-2.25.3.jar
1016+
lib/log4j-core-2.25.3.jar
1017+
lib/log4j-jcl-2.25.3.jar
1018+
lib/log4j-jul-2.25.3.jar
1019+
lib/log4j-slf4j-impl-2.25.3.jar
10201020
lib/logback-classic-1.5.11.jar
10211021
lib/logback-core-1.5.11.jar
10221022
lib/lucene-analysis-common-9.12.3.jar

geode-assembly/src/integrationTest/resources/gfsh_dependency_classpath.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ jaxb-runtime-4.0.2.jar
3232
jaxb-core-4.0.2.jar
3333
jakarta.xml.bind-api-4.0.2.jar
3434
jopt-simple-5.0.4.jar
35-
log4j-slf4j-impl-2.17.2.jar
36-
log4j-core-2.17.2.jar
37-
log4j-jcl-2.17.2.jar
38-
log4j-jul-2.17.2.jar
39-
log4j-api-2.17.2.jar
35+
log4j-slf4j-impl-2.25.3.jar
36+
log4j-core-2.25.3.jar
37+
log4j-jcl-2.25.3.jar
38+
log4j-jul-2.25.3.jar
39+
log4j-api-2.25.3.jar
4040
spring-aop-6.1.14.jar
4141
spring-shell-autoconfigure-3.3.3.jar
4242
spring-shell-standard-commands-3.3.3.jar

geode-docs/managing/logging/configuring_log4j2.html.md.erb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ You can also configure Log4j 2 to work with various popular and commonly used lo
3636
3737
For example, if you are using:
3838
39-
- **Commons Logging**, download "Commons Logging Bridge" (`log4j-jcl-2.17.2.jar`)
40-
- **SLF4J**, download "SLFJ4 Binding" (`log4j-slf4j-impl-2.17.2.jar`)
41-
- **java.util.logging**, download the "JUL adapter" (`log4j-jul-2.17.2.jar`)
39+
- **Commons Logging**, download "Commons Logging Bridge" (`log4j-jcl-2.25.3.jar`)
40+
- **SLF4J**, download "SLFJ4 Binding" (`log4j-slf4j-impl-2.25.3.jar`)
41+
- **java.util.logging**, download the "JUL adapter" (`log4j-jul-2.25.3.jar`)
4242
4343
See [http://logging.apache.org/log4j/2.x/faq.html](http://logging.apache.org/log4j/2.x/faq.html) for more examples.
4444
45-
All three of the above JAR files are in the full distribution of Log4J 2.17.2 which can be downloaded at [http://logging.apache.org/log4j/2.x/download.html](http://logging.apache.org/log4j/2.x/download.html). Download the appropriate bridge, adapter, or binding JARs to ensure that <%=vars.product_name%> logging is integrated with every logging API used in various third-party libraries or in your own applications.
45+
All three of the above JAR files are in the full distribution of Log4J 2.25.3 which can be downloaded at [http://logging.apache.org/log4j/2.x/download.html](http://logging.apache.org/log4j/2.x/download.html). Download the appropriate bridge, adapter, or binding JARs to ensure that <%=vars.product_name%> logging is integrated with every logging API used in various third-party libraries or in your own applications.
4646
4747
**Note:**
48-
<%=vars.product_name_long%> has been tested with Log4j 2.17.2. As newer versions of Log4j 2 come out, you can find 2.17.2 under Previous Releases on that page.
48+
<%=vars.product_name_long%> has been tested with Log4j 2.25.3. As newer versions of Log4j 2 come out, you can find 2.25.3 under Previous Releases on that page.
4949
5050
## Customizing Your Own log4j2.xml File
5151

geode-docs/managing/logging/how_logging_works.html.md.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ limitations under the License.
2121
2222
<%=vars.product_name%> uses [Apache Log4j 2](http://logging.apache.org/log4j/2.x/) API and Core libraries as the basis for its logging system. Log4j 2 API is a popular and powerful front-end logging API used by all the <%=vars.product_name%> classes to generate log statements. Log4j 2 Core is a backend implementation for logging; you can route any of the front-end logging API libraries to log to this backend. <%=vars.product_name%> uses the Core backend to run three custom Log4j 2 Appenders: **GeodeConsole**, **GeodeLogWriter**, and **GeodeAlert**.
2323
24-
<%=vars.product_name%> has been tested with Log4j 2.17.2.
24+
<%=vars.product_name%> has been tested with Log4j 2.25.3.
2525
<%=vars.product_name%> requires the
26-
`log4j-api-2.17.2.jar` and `log4j-core-2.17.2.jar`
26+
`log4j-api-2.25.3.jar` and `log4j-core-2.25.3.jar`
2727
JAR files to be in the classpath.
2828
Both of these JARs are distributed in the `<path-to-product>/lib` directory and included in the appropriate `*-dependencies.jar` convenience libraries.
2929

geode-docs/tools_modules/http_session_mgmt/weblogic_setting_up_the_module.html.md.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ If you are deploying an ear file:
108108
lib/geode-serialization-2.0.0.jar
109109
lib/jakarta.transaction-api-2.0.1.jar
110110
lib/jgroups-3.6.20.Final.jar
111-
lib/log4j-api-2.17.2.jar
112-
lib/log4j-core-2.17.2.jar
113-
lib/log4j-jul-2.17.2.jar
111+
lib/log4j-api-2.25.3.jar
112+
lib/log4j-core-2.25.3.jar
113+
lib/log4j-jul-2.25.3.jar
114114
```
115115
116116
## <a id="weblogic_setting_up_the_module__section_20294A39368D4402AEFB3D074E8D5887" class="no-quick-link"></a>Peer-to-Peer Setup

geode-log4j/build.gradle

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,24 @@ plugins {
2121
id 'jmh'
2222
}
2323

24+
// GEODE-10543: Configure GraalVM annotation processor options for Log4j 2.25.3
25+
// Log4j 2.25.3 includes a GraalVM Reachability Metadata annotation processor that generates
26+
// plugin descriptors for native image compilation. Without these options, the processor emits
27+
// warnings about missing Maven coordinates, which are treated as compilation errors by Gradle.
28+
//
29+
// These options specify the Maven coordinates (groupId:artifactId) for the generated plugin
30+
// descriptors, suppressing the warnings and allowing compilation to succeed.
31+
//
32+
// Apply only to main source compilation, as integration tests don't trigger the annotation processor.
33+
//
34+
// Reference: https://issues.apache.org/jira/browse/LOG4J2-3642
35+
tasks.named('compileJava').configure {
36+
options.compilerArgs += [
37+
'-Alog4j.graalvm.groupId=org.apache.geode',
38+
'-Alog4j.graalvm.artifactId=geode-log4j'
39+
]
40+
}
41+
2442
dependencies {
2543
api(platform(project(':boms:geode-all-bom')))
2644

@@ -63,8 +81,15 @@ dependencies {
6381
exclude module: 'geode-core'
6482
}
6583
integrationTestImplementation('junit:junit')
66-
integrationTestImplementation('org.apache.logging.log4j:log4j-core::tests')
67-
integrationTestImplementation('org.apache.logging.log4j:log4j-core::test-sources')
84+
// Log4j 2.20.0+ moved test utilities to log4j-core-test with new package names:
85+
// org.apache.logging.log4j.junit → org.apache.logging.log4j.core.test.junit
86+
// org.apache.logging.log4j.test → org.apache.logging.log4j.core.test
87+
// log4j-core-test 2.25.3 transitively depends on assertj-core 3.27.3, but Geode's
88+
// custom AssertJ assertions were built against 3.22.0. Force 3.22.0 to avoid
89+
// NoSuchMethodError: CommonValidations.failIfEmptySinceActualIsNotEmpty
90+
integrationTestImplementation('org.apache.logging.log4j:log4j-core-test') {
91+
exclude group: 'org.assertj', module: 'assertj-core'
92+
}
6893
integrationTestImplementation('org.assertj:assertj-core')
6994

7095
distributedTestImplementation(project(':geode-junit')) {

geode-log4j/src/integrationTest/java/org/apache/geode/alerting/log4j/internal/impl/AlertAppenderIntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import org.apache.logging.log4j.Level;
3737
import org.apache.logging.log4j.Logger;
3838
import org.apache.logging.log4j.core.LogEvent;
39-
import org.apache.logging.log4j.junit.LoggerContextRule;
39+
import org.apache.logging.log4j.core.test.junit.LoggerContextRule;
4040
import org.junit.After;
4141
import org.junit.Before;
4242
import org.junit.BeforeClass;

0 commit comments

Comments
 (0)