feat: improve Sonatype Guide / OSS Index cache handling and insufficient credits error reporting#8451
Merged
jeremylong merged 6 commits intodependency-check:mainfrom Apr 29, 2026
Conversation
…indexClient The client already de-duplicates these via their equality before constructing a batch; but doing so here makes the logged values consistent with what is actually submitted (assuming empty/disabled cache) which makes debugging easier. Signed-off-by: Chad Wilson <[email protected]>
… to insufficient credits Signed-off-by: Chad Wilson <[email protected]>
Signed-off-by: Chad Wilson <[email protected]>
…idity length Signed-off-by: Chad Wilson <[email protected]>
Signed-off-by: Chad Wilson <[email protected]>
Signed-off-by: Chad Wilson <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Sonatype OSS Index analyzer integration to better align with the Sonatype Guide compatibility API by improving cache configurability, error handling/reporting, and related test coverage.
Changes:
- Add a configurable OSS Index cache validity window (default 24h) across CLI/Maven/Ant (and documented for Gradle).
- Improve OSS Index error classification/messaging (including explicit handling for HTTP 402) and reduce wasteful retries for fatal errors.
- Add/refactor tests and test helpers around OSS Index client creation/config and analyzer error behaviors; deduplicate PURLs prior to submission.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java | Adds new settings key for OSS Index cache validity duration. |
| src/site/markdown/dependency-check-gradle/configuration.md | Documents new Gradle validForHours setting for OSS Index caching. |
| src/site/markdown/dependency-check-gradle/configuration-aggregate.md | Documents new Gradle validForHours setting for aggregate configuration. |
| maven/src/site/markdown/configuration.md | Documents new Maven cache validity setting separate from cache enablement. |
| maven/src/main/java/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java | Wires new Maven parameter into core settings. |
| maven/src/it/2494-managed-reactor-dependencies/pom.xml | Updates IT config to use the non-deprecated OSS Index enable property name. |
| core/src/test/resources/dependencycheck.properties | Adjusts test config commentary around disabling OSS Index analyzer. |
| core/src/test/java/org/owasp/dependencycheck/data/ossindex/OssIndexHelper.java | Adds reusable OSS Index test helpers and static mocking utilities. |
| core/src/test/java/org/owasp/dependencycheck/data/ossindex/OssIndexClientProviderTest.java | Adds test coverage for default/custom cache config and transport setup. |
| core/src/test/java/org/owasp/dependencycheck/analyzer/OssIndexAnalyzerTest.java | Refactors/expands analyzer tests for error handling, retries, and enrichment behavior. |
| core/src/main/java/org/owasp/dependencycheck/data/ossindex/OssIndexClientProvider.java | Renames/refactors OSS Index client creation and adds configurable cache expiry. |
| core/src/main/java/org/owasp/dependencycheck/data/ossindex/ODCConnectionTransport.java | Adds package-private access to user agent for testing. |
| core/src/main/java/org/owasp/dependencycheck/analyzer/OssIndexAnalyzer.java | Implements improved batching/dedup, error classification, and retry/disable behavior. |
| cli/src/site/markdown/arguments.md | Documents new CLI argument for OSS Index cache validity window. |
| cli/src/main/resources/completion-for-dependency-check.sh | Adds new CLI option completions for OSS Index cache validity and related args. |
| cli/src/main/java/org/owasp/dependencycheck/CliParser.java | Adds CLI option and argument constant for OSS Index cache validity. |
| cli/src/main/java/org/owasp/dependencycheck/App.java | Maps new CLI option into settings (ANALYZER_OSSINDEX_CACHE_VALID_FOR_HOURS). |
| ant/src/test/resources/build.xml | Updates Ant test build configs to use non-deprecated OSS Index attribute naming. |
| ant/src/site/markdown/configuration.md | Documents new Ant cache validity setting. |
| ant/src/main/java/org/owasp/dependencycheck/taskdefs/Check.java | Adds Ant task support for cache validity and aligns naming with non-deprecated attributes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jeremylong
approved these changes
Apr 29, 2026
Collaborator
Author
|
Thanks for taking a look! The matching Gradle plugin PR is at dependency-check/dependency-check-gradle#507 and is now passing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of Change
As floated vaguely at #8450 makes a few improvements to the OSS Index Analyzer to better support the new Sonatype Guide compatibility API
402Payment Requiredresponse specifically handled with dedicated error messageSmaller tweaks
Related issues
Have test cases been added to cover the new functionality?
yes