Skip to content

Backport: Fix excessive churn of vulnerable software associations during mirroring - #7256

Merged
nscuro merged 1 commit into
DependencyTrack:4.14.xfrom
nscuro:backport-pr-6499-4.14.x
Sep 8, 2026
Merged

nscuro merged 1 commit into
DependencyTrack:4.14.xfrom
nscuro:backport-pr-6499-4.14.x

Conversation

@nscuro

@nscuro nscuro commented Sep 8, 2026

Copy link
Copy Markdown
Member

Description

Fixes excessive churn of vulnerable software associations during mirroring.

Addressed Issue

Backports #6499

Additional Details

N/A

Checklist

  • I have read and understand the contributing guidelines
  • This PR fixes a defect, and I have provided tests to verify that the fix is effective
  • This PR implements an enhancement, and I have provided tests to verify that it works as intended
  • This PR introduces changes to the database model, and I have updated the migration changelog accordingly
  • This PR introduces new or alters existing behavior, and I have updated the documentation accordingly
  • This PR is a substantial change (per the ADR criteria), and I have added an ADR under docs/adr/

Nearly every OSV mirror run deletes and re-inserts the `VULNERABLESOFTWARE`
<-> `VULNERABILITY` associations (and their `AFFECTEDVERSIONATTRIBUTION`
records) of ecosystems like Ubuntu, even when the affected version ranges did
not change. This bloats `VULNERABLESOFTWARE_VULNERABILITIES` and
`AFFECTEDVERSIONATTRIBUTION`, resets `firstSeen`, and makes both mirroring and
maintenance slow.

`synchronizeVulnerableSoftware` reconciles associations by matching previously
reported records against freshly parsed ones via
`VulnerableSoftware#equalsIgnoringDatastoreIdentity`. That comparison includes
the full `purl` and `purlVersion`, but the lookup it relies on to re-resolve
records matches only on the "decomposed" PURL and version range. When a stored
record's `purl` differs while those coordinates are unchanged, it fails to
match and is removed, only for the PURL-blind lookup to immediately re-resolve
the same row and re-add it.

Ubuntu's OSV data embeds the source package version in `package.purl`, and
bumps it whenever an advisory is updated. The version range derived from it
does not change, so those records churn on every run.

`purl` and `purlVersion` are derived from the decomposed coordinates that
already define a record's identity, and are exactly what the lookup matches
on. This change excludes them from `equalsIgnoringDatastoreIdentity` and
`hashCodeWithoutDatastoreIdentity`, so a record whose PURL was merely
re-serialized is correctly treated as unchanged.

(cherry picked from commit 5ebe40a)
Signed-off-by: nscuro <nscuro@protonmail.com>
@nscuro nscuro added this to the 4.14.4 milestone Sep 8, 2026
@owasp-dt-bot

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics -6 complexity

Metric Results
Complexity -6

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@nscuro nscuro added the defect Something isn't working label Sep 8, 2026
@nscuro
nscuro merged commit f38999a into DependencyTrack:4.14.x Sep 8, 2026
9 checks passed
@nscuro
nscuro deleted the backport-pr-6499-4.14.x branch September 8, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

defect Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants