Skip to content

fix: correct expiry of NODEAUDIT/CENTRAL/POM caches by ensuring values inherit from default region - #8865

Merged
jeremylong merged 1 commit into
dependency-check:mainfrom
chadlwilson:fix-cache-expiries
Nov 1, 2026
Merged

jeremylong merged 1 commit into
dependency-check:mainfrom
chadlwilson:fix-cache-expiries

Conversation

@chadlwilson

@chadlwilson chadlwilson commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Description of Change

Currently JCS caches are not expiring correctly because the elements are being set to Eternal which overrides the max lifetime entries that are being set.

This means node audit, central and POM results are being cached indefinitely, far longer than originally intended. For node audit this means false negatives and positives. For central and its POM perhaps no real effect as POMs should be immutable and the central results for a SHA search shouldn't really be changing, except when multiple artifacts match.

This was happening because the programmatic logic was overriding the default region attributes entirely. This change

  • allows default attributes to be inherited from a single place
  • avoids mixing programmatic and .properties "default" configuration which caused this issue
  • resets configuration for elements on access so they expire as intended; without unnecessary refetching or wiping of the entire cache (which might cause Central load storm)

Related issues

Have test cases been added to cover the new functionality?

yes

… region

Signed-off-by: Chad Wilson <29788154+chadlwilson@users.noreply.github.com>
@boring-cyborg boring-cyborg Bot added core changes to core tests test cases labels Oct 31, 2026
@chadlwilson
chadlwilson requested a balanced review from Copilot October 31, 2026 06:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The persisted JCS expiry rewrite, including vulnerability results, needs restart-test and real pre-fix cache upgrade validation because serialization and asynchronous disk-write behavior cannot be verified in this snapshot.

No open issues 🎉

What changed in this PR

Fixes #8757 by restoring intended expiration for the CENTRAL, POM, and NODEAUDIT caches, while preserving legacy entries that are still within their configured lifetime.

Changes:

  • Centralizes cache defaults in properties so regions inherit non-eternal expiration settings.
  • Repairs legacy eternal entries on access, preserving creation times and removing expired entries.
  • Adds disk-backed regression tests for policy inheritance, restart persistence, and legacy-entry repair.
File Description
core/​src/​test/​java/​org/​owasp/​dependencycheck/​data/​cache/​DataCacheFactoryTest.java Adds expiration, persistence, and legacy-cache regression tests.
core/​src/​main/​resources/​dependencycheck-cache.properties Consolidates inherited defaults and retains region-specific lifetimes.
core/​src/​main/​java/​org/​owasp/​dependencycheck/​data/​cache/​DataCacheFactory.java Refactors initialization and removes programmatic region overrides.
core/​src/​main/​java/​org/​owasp/​dependencycheck/​data/​cache/​DataCache.java Reconciles legacy eternal entries with the region’s expiration policy.

Review effort: Balanced

@jeremylong
jeremylong merged commit cb125ee into dependency-check:main Nov 1, 2026
17 checks passed
@chadlwilson
chadlwilson deleted the fix-cache-expiries branch November 1, 2026 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core changes to core tests test cases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CENTRAL - NODEAUDIT - POM Cached results never expire

3 participants