DependencyTrack / DependencyTrack/dependency-track

Use stricter identity comparison when merging components

Open
#3,861 5 comments 0 reactions 0 assignees View on GitHub
enhancement p2 size/M
Dominant language
Java
Stars
4.2k
Forks
811
Avg merge
8h 39m
Merged PRs (30d)
237

Description

### Current Behavior

When uploading a BOM, components are merged based on their [identity as defined here](https://github.com/DependencyTrack/dependency-track/blob/66e9ae366784f857523215344fbda23cde6c31bb/src/main/java/org/dependencytrack/model/ComponentIdentity.java#L142). Broadly speaking, if there are multiple components in the BOM with the same ID fields (PURL, CPE, name, version, etc), only one of them will be saved in the database.

### Proposed Behavior

Some BOMs contain multiple components with the same identity, but differing properties for these components. The BOM may contain components from many different projects, some of which might include the same dependencies.

In this scenario we don't just want to know that we depend on component `A`, or that component `A` has a vulnerability - we want to know which projects depend on `A`. We can only easily do that if every component is present in Dependency-Track as it is in the BOM.

Somehow we would like to be able to upload a BOM, and know that after the upload, the project in Dependency-Track will exactly mirror the contents of the BOM. Options include:
1. Change the existing identity check to use full equality. This will presumably break some use cases that depend on the existing identity-based merging? (I'm not sure what these use cases are)
2. Add an option to use equality when uploading a BOM. This feels complex - the behaviour of a project could vary over time unexpectedly.
3. Add an option to a project, so it can be configured to use strict component equality
a. a new flag at the project level (like the "active" toggle)
b. define a special property and use that, e.g. `dependency-track / component-merge / strict`
4. Make the behaviour configurable instance-wide in the settings.

Option 3a seems like a reasonable solution to me?

### Checklist

- [X] I have read and understand the [contributing guidelines](https://github.com/DependencyTrack/dependency-track/blob/master/CONTRIBUTING.md#filing-issues)
- [X] I have checked the [existing issues](https://github.com/DependencyTrack/dependency-track/issues) for whether this enhancement was already requested

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.