Skip to content

Set file_path on dependency locations in the Dependency-Track parser #15940

Description

@webdevred

Is your feature request related to a problem? Please describe

A Dependency-Track finding says which package is vulnerable and nothing about where it is used, so triage starts by searching the source by hand. When packages are built in one repository and consumed in another, that search often lands in the wrong repository and the finding gets closed as not applicable by a team that really cannot find the package in their own code.

The Dependency-Track parser creates a location per finding with the purl and nothing else:

finding.unsaved_locations.append(
    LocationData.dependency(purl=component_purl),
)

Other SCA parsers already fill file_path on the same factory:

  • anchore_grype: LocationData.dependency(purl=artifact_purl, file_path=file_path)
  • dependency_check: LocationData.dependency(purl=component_purl, file_path=dependency_filename)
  • gitlab_dep_scan: file_path=file_path
  • govulncheck: file_path=path
  • jfrog_xray_api_summary_artifact: file_path=impact_path
  • blackduck_binary_analysis: file_path=file_path

So the Dependency-Track parser is the one that leaves it empty.

Describe the solution you'd like
As someone triaging Dependency-Track findings in DefectDojo, I want the dependency locations to carry the paths Dependency-Track reports for the component, the way the parsers above do, so that I can see where a vulnerable package is used without leaving the finding.

When the report carries the component's occurrences, add one dependency location per occurrence with file_path set from it, instead of one location holding only the purl. unsaved_locations is already a list, so several locations per finding need nothing new.

One finding stays one finding. #14941 folded Dependency-Check's related paths into the description to stop that parser emitting a finding per path, and this is not a step back towards it: the occurrences become locations on the one finding, never findings of their own.

This is parity rather than new surface: no model, no new Finding field, no UI page, no API route, and file_path on a dependency location is already in use by six parsers. I would still like pre-approval before opening a PR, per the contributing guide.

Describe alternatives you've considered
The description. The parser appends analysis.detail as Audit Detail: ..., which is where our paths end up today, and #14941 does something similar with a **Related Filepaths:** block for Dependency-Check. It reads fine. What it does not do is let anyone filter on a path, which LocationFilter gives for locations, and the formatting is whatever the producer happened to write.

Putting the real path in finding.file_path. That breaks deduplication, which depends on the purl being there, per the parser comment and #3647.

Fetching the occurrences from Dependency-Track. The parser is handed the uploaded report through get_findings(self, file, test) and sees nothing else, and a file parser should not be making network calls.

Additional context

The blocker is upstream rather than here. Dependency-Track's Finding Packaging Format carries component.hasOccurrences as a boolean and no occurrences, so the parser has nothing to read. Dependency-Track does hold the data: our js BOMs carry evidence.occurrences, it imports them and shows them in its component view, and only the export drops them. I have asked for the export side there: DependencyTrack/dependency-track#7291.

Filing this separately so the consumer half is written down, and so the shape can be settled before the data turns up.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions