-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix: correct reliability of Central etc (JCS cache) analyzers on Java 25/Docker by making CLI classpath deterministic #8117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ce99a8f to
1794fa4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes reliability issues with Central and other JCS cache analyzers on Java 25/Docker by making the CLI classpath deterministic. The key change is moving away from wildcard classpath usage to an executable JAR with a deterministic Class-Path manifest entry, ensuring the JCS3 SLF4J logging adapter is discovered before the default JCS3 LogFactory providers as a workaround for JDK-8350481.
- Centralizes JCS3 logging adapter configuration in
DataCacheFactorystatic initializer - Converts CLI to use executable JAR with deterministic classpath via manifest
- Implements
PluginLoaderJava agent to enable plugin support by appending JARs to classpath before main class initialization
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| core/src/main/java/org/owasp/dependencycheck/data/cache/DataCacheFactory.java | Adds static initializer to configure JCS3 logging adapter, centralizing the configuration that was previously scattered across multiple entry points |
| core/src/main/java/org/owasp/dependencycheck/data/cache/DataCache.java | Changes constructor visibility from public to package-private as it's only instantiated within the same package |
| core/pom.xml | Reorders dependencies to place jcs3-slf4j before commons-jcs3-core for deterministic classpath ordering |
| maven/src/main/java/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java | Removes JCS3 logging configuration now centralized in DataCacheFactory |
| maven/pom.xml | Removes direct jcs3-slf4j dependency as it's now transitively included from core |
| cli/src/main/java/org/owasp/dependencycheck/App.java | Removes JCS3 logging configuration now centralized in DataCacheFactory |
| cli/src/main/java/org/owasp/dependencycheck/PluginLoader.java | New Java agent implementation for loading plugin JARs from a directory into the classpath |
| cli/src/test/java/org/owasp/dependencycheck/PluginLoaderTest.java | Unit tests for the new PluginLoader agent |
| cli/src/main/resources/logback.xml | Updates JCS logger name from jcs to jcs3 and changes level to FATAL |
| cli/src/main/conf/unixBinTemplate.sh | Removes wildcard classpath handling to support deterministic JAR execution |
| cli/src/main/conf/windowsBinTemplate.bat | New Windows batch script template with deterministic classpath support |
| cli/pom.xml | Configures JAR manifest with Class-Path and Premain-Class entries, updates appassembler to use -jar execution, adds windowsScriptTemplate configuration |
| ant/src/main/java/org/owasp/dependencycheck/taskdefs/Purge.java | Removes JCS3 logging configuration now centralized in DataCacheFactory |
| ant/pom.xml | Removes direct jcs3-slf4j dependency as it's now transitively included from core |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
core/src/main/java/org/owasp/dependencycheck/data/cache/DataCacheFactory.java
Show resolved
Hide resolved
cli/src/test/java/org/owasp/dependencycheck/PluginLoaderTest.java
Outdated
Show resolved
Hide resolved
0b664f3 to
821208e
Compare
…acheFactory - allows us to workaround dependency-check#8108 - makes API for `core` consistently SLF4J based - debug logging derived from logger configuration for the DataCacheFactory itself Signed-off-by: Chad Wilson <[email protected]>
821208e to
feffbbc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dependency-check/DependencyCheck#8117 upstreams this configuration to dependency-check-core, so this is no longer necessary. It wasn't always working correctly/deterministically for some reason (possibly Gradle's internal use of slf4j?), so hopefully this addresses the situation more reliably for the Gradle plugin. Signed-off-by: Chad Wilson <[email protected]>
…asspath ordering - without using wildcards, avoids getting into Windows command length issues as in dependency-check#2062 - tidies the appassembler Windows launch script generation to use a template, similar to *nix systems - adds a Java Agent plugin loading mechanism to be able to add additional "plugin" jars onto the classpath as before Signed-off-by: Chad Wilson <[email protected]>
feffbbc to
ba9d8ba
Compare
|
Thanks! I'm going to do a point release today. We'll include this in the upcoming feature release. |
|
Not sure if you read the linked issue, but right now the docker image is (non-deterministically) broken (varying probably due to the file system overlay and docker storage driver, along with architecture). |
|
If you want to restore stability at lower risk you might want to downgrade back to Java 21. (raised #8124 if you want to do this) (edit: ahh ok, you already cut the 12.1.9 release) |
Description of Change
DataCacheFactory.DataCacheFactoryitself is set toTRACElogging. This effective mutes it everywhere by default.Slf4jAdapteris discovered before the default JCS3LogFactoryproviders, which is a workaround for the JDK 24+ issue https://bugs.openjdk.org/browse/JDK-8350481 , still not fixed as of25.0.1.Ancillary changes
Related issues
Have test cases been added to cover the new functionality?
yes
Manually tested on
pluginsjarpluginsjarAdditional detail
.shdiff:.batdiff: (view word wrap on)Manifest for CLI looks like the below (80 jars, same as in
libdir)