Skip to content

Set finding mitigation from Dependency Track affected version ranges - #15366

Open
webdevred wants to merge 4 commits into
DefectDojo:devfrom
webdevred:forward-affected-versions-from-dependency-track
Open

Set finding mitigation from Dependency Track affected version ranges#15366
webdevred wants to merge 4 commits into
DefectDojo:devfrom
webdevred:forward-affected-versions-from-dependency-track

Conversation

@webdevred

@webdevred webdevred commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Description

When Dependency Track pushes findings via the Finding Packaging Format, each vulnerability now carries the affected version ranges per component. DefectDojo dropped them, so a finding told an auditor a component was vulnerable but not which release to move to, leaving the upgrade target to be looked up by hand in the advisory.

This reads those ranges and sets the finding mitigation. For the range the installed component version falls in, it uses versionEndExcluding (the first patched version) to say "Upgrade to X or later", and falls back to "Upgrade to a version after X" from versionEndIncluding when no exact fix version is known. Ranges are matched to the component by purl and compared with packaging, so when a vulnerability spans several release lines the range the installed version actually sits in is the one used. Exact-version entries and component versions that do not parse are left without a mitigation rather than guessing, and findings whose vulnerability has no affected version ranges are unchanged.

This needs the Dependency Track side that emits the ranges (FPF 1.6). It implements #15239 and is the companion to the Dependency Track change that adds the affected version ranges to the FPF export (DependencyTrack/dependency-track#5907).

Test results

Added unit tests and FPF fixtures under unittests/ covering the exact-fix case, the versionEndIncluding wording, multi-range selection (the installed version picks its own range), the exact-version-entry guard, and the unparseable-version fallback. The full TestDependencyTrackParser suite passes and the code is Ruff compliant. Also verified end to end by importing a sample FPF export into a running DefectDojo and confirming the mitigation was set on the resulting findings (for example log4j-core 2.14.1 gets "Upgrade to 2.15.0 or later").

Documentation

No documentation change needed. This enriches the output of the existing Dependency Track parser (it now sets the mitigation field) and does not add a new parser, setting, or model.

Checklist

  • Make sure to rebase your PR against the very latest dev.
  • Features/Changes should be submitted against the dev.
  • Bugfixes should be submitted against the bugfix branch.
  • Give a meaningful name to your PR, as it may end up being used in the release notes.
  • Your code is Ruff compliant (see ruff.toml).
  • Your code is python 3.13 compliant.
  • If this is a new feature and not a bug fix, you've included the proper documentation in the docs at https://github.com/DefectDojo/django-DefectDojo/tree/dev/docs as part of this PR.
  • Model changes must include the necessary migrations in the dojo/db_migrations folder.
  • Add applicable tests to the unit tests.
  • Add the proper label to categorize your PR.

Read the affectedVersions ranges the Dependency Track FPF now exports and set
the finding mitigation to the first patched version (versionEndExcluding),
matched to the finding's component by purl. This surfaces the upgrade target
without opening the advisory. Handles a single affected range for now.
…ation

When a vulnerability lists several affected ranges for the same component,
compare the installed version against each range's bounds and use the fix
from the range it falls in, so a component on the 2.x line is not pointed at
a 3.x fix. Fall back to the single range when only one matches, and to no
mitigation when the version cannot be parsed.
…is known

When the affected range the component falls in has no versionEndExcluding there
is no exact first fixed version to name. Use versionEndIncluding instead and word
the mitigation as an upgrade to a version after the last affected version.
Treat an affected-version entry with no range bounds (an exact-version entry) as
not containing any version, so it no longer matches every component or masks a
real range in the process. Apply the containment check to a single matched range
as well, and fall back to a lone range only when the component version cannot be
compared.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant