GEODE-10544: Upgrade Apache Log4j from version 2.17.2 to 2.25.3 to remediate security vulnerability CVE-2025-68161. #7978
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR upgrades Apache Log4j from version 2.17.2 to 2.25.3 in the Geode 1.15 codebase to remediate security vulnerability CVE-2025-68161. This upgrade also brings performance improvements from the latest Log4j release. All tests pass successfully.
Security Impact
CVE-2025-68161: This upgrade addresses a critical security vulnerability in Log4j 2.17.2. Upgrading to 2.25.3 remediates this vulnerability and ensures the security of applications using Geode 1.15.
Changes Made
1. Version Update
build-tools/geode-dependency-management/src/main/groovy/org/apache/geode/gradle/plugins/DependencyConstraints.groovylog4j.versionfrom"2.17.2"to"2.25.3"log4j-core-testto the dependency set (line 215-221)2. GraalVM Configuration
geode-log4j/build.gradle3. Test Dependency Migration
File:
geode-log4j/build.gradleMigrated from
log4j-core::testsandlog4j-core::test-sources(removed in 2.25.3)Log4j 2.20.0+ moved test utilities to log4j-core-test with new package names:
org.apache.logging.log4j.junit → org.apache.logging.log4j.core.test.junit
org.apache.logging.log4j.test → org.apache.logging.log4j.core.test
Added
log4j-core-testartifact with exclusions to resolve dependency conflicts:Exclusions required because:
log4j-core-test 2.25.3requires the following exclusions:(NoSuchMethodError: CommonValidations.failIfEmptySinceActualIsNotEmpty)
(JUnitException: OutputDirectoryProvider not available due to version mismatch)
4. Package Structure Updates (20 Integration Test Files)
Log4j 2.25.3 reorganized test utility packages. Updated imports in all integration test files:
Old Package Names:
org.apache.logging.log4j.junit.LoggerContextRuleorg.apache.logging.log4j.test.appender.ListAppenderNew Package Names:
org.apache.logging.log4j.core.test.junit.LoggerContextRuleorg.apache.logging.log4j.core.test.appender.ListAppenderFiles Updated:
AlertAppenderIntegrationTest.javaBothLogWriterAppendersIntegrationTest.javaCacheWithCustomLogConfigIntegrationTest.javaConfigurationWithLogLevelChangesIntegrationTest.javaConsoleAppenderWithLoggerContextRuleIntegrationTest.javaDistributedSystemWithBothLogWriterAppendersIntegrationTest.javaDistributedSystemWithLogLevelChangesIntegrationTest.javaFastLoggerIntegrationTest.javaGemfireVerboseMarkerFilterAcceptIntegrationTest.javaGemfireVerboseMarkerFilterDenyIntegrationTest.javaGeodeConsoleAppenderIntegrationTest.javaGeodeConsoleAppenderWithCacheIntegrationTest.javaGeodeConsoleAppenderWithSystemOutRuleIntegrationTest.javaGeodeVerboseMarkerFilterAcceptIntegrationTest.javaGeodeVerboseMarkerFilterDenyIntegrationTest.javaLogServiceWithCustomLogConfigIntegrationTest.javaLogWriterAppenderIntegrationTest.javaLogWriterAppenderWithLimitsIntegrationTest.javaLogWriterAppenderWithMemberNameInXmlIntegrationTest.javaSecurityLogWriterAppenderIntegrationTest.java5. Deprecation Warning Fix
geode-logging/src/main/java/org/apache/geode/logging/internal/log4j/api/message/GemFireParameterizedMessage.java@SuppressWarnings("deprecation")annotation togetFormat()methodMessage.getFormat()but Geode must maintain interface compatibilityBreaking Changes in Log4j 2.25.3
Test Artifact Restructuring
log4j-core::testsandlog4j-core::test-sourcesclassifier artifactslog4j-core-testMaven artifactPackage Reorganization
org.apache.logging.log4j.core.test.*packagesAPI Deprecations
Message.getFormat()method deprecatedTesting Performed
All Tests Passed
./gradlew :geode-log4j:test- All tests pass./gradlew :geode-log4j:integrationTest- All 177 tests pass./gradlew clean build -x test- Successful (BUILD SUCCESSFUL in 1m 20s)spotlessCheck- Code formatting verifiedrat- License headers validatedcheckPom- POM files validatedpmdMain- Static analysis passedjapicmp- API/ABI compatibility verifiedresolveDependencies- Dependency resolution successful./gradlew install- Successful./gradlew javadoc- Generated successfullyKey Test Fixes
Resolved initial integration test failures by excluding conflicting transitive dependencies from
log4j-core-test:Full Build Test Results
Dependency Analysis
Before (Log4j 2.17.2)
dependencies { implementation("org.apache.logging.log4j:log4j-api:2.17.2") implementation("org.apache.logging.log4j:log4j-core:2.17.2") integrationTestImplementation("org.apache.logging.log4j:log4j-core:2.17.2:tests") }After (Log4j 2.25.3)
dependencies { implementation("org.apache.logging.log4j:log4j-api:2.25.3") implementation("org.apache.logging.log4j:log4j-core:2.25.3") integrationTestImplementation("org.apache.logging.log4j:log4j-core-test:2.25.3") { exclude group: 'org.apache.maven' exclude group: 'org.apache.logging.log4j', module: 'log4j-api-test' exclude group: 'org.assertj', module: 'assertj-core' exclude group: 'org.junit.jupiter' exclude group: 'org.junit.platform' } }Migration Reference
This upgrade was guided by the patterns from:
Checklist
Recommendations for Reviewers
Focus Areas:
Testing Strategy:
./gradlew clean build -x test./gradlew test./gradlew :geode-log4j:test :geode-log4j:integrationTest./gradlew spotlessCheck rat checkPom japicmpFuture Work:
Related Issues
support/1.15support/1.15Additional Notes
This is a targeted security upgrade for the 1.15 support branch to remediate CVE-2025-68161. The main development branch may already have a newer version of Log4j. This upgrade focuses on security and stability improvements for the 1.15 release line while maintaining full backward compatibility.
Important: This upgrade should be prioritized for deployment to production environments to address the security vulnerability.
For all changes, please confirm:
develop)?gradlew buildrun cleanly?