-
-
Notifications
You must be signed in to change notification settings - Fork 579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add source attributions for affected component version ranges #2098
Merged
nscuro
merged 23 commits into
DependencyTrack:master
from
sahibamittal:Issue-1815-handle-affected-package-versions
Nov 15, 2022
Merged
Add source attributions for affected component version ranges #2098
nscuro
merged 23 commits into
DependencyTrack:master
from
sahibamittal:Issue-1815-handle-affected-package-versions
Nov 15, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Sahiba Mittal <sahibamittal98@gmail.com>
Signed-off-by: Sahiba Mittal <sahibamittal98@gmail.com>
src/main/java/org/dependencytrack/resources/v1/vo/AffectedComponent.java
Outdated
Show resolved
Hide resolved
|
Signed-off-by: Sahiba Mittal <sahibamittal98@gmail.com>
Signed-off-by: Sahiba Mittal <sahibamittal98@gmail.com>
Signed-off-by: Sahiba Mittal <sahibamittal98@gmail.com>
src/main/java/org/dependencytrack/model/AffectedVersionAttribution.java
Outdated
Show resolved
Hide resolved
nscuro
reviewed
Oct 28, 2022
Signed-off-by: Sahiba Mittal <sahibamittal98@gmail.com>
Signed-off-by: Sahiba Mittal <sahibamittal98@gmail.com>
Signed-off-by: Sahiba Mittal <sahibamittal98@gmail.com>
nscuro
requested changes
Nov 1, 2022
src/main/java/org/dependencytrack/tasks/GitHubAdvisoryMirrorTask.java
Outdated
Show resolved
Hide resolved
src/main/java/org/dependencytrack/model/VulnerableSoftware.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Sahiba Mittal <sahibamittal98@gmail.com>
This comment was marked as outdated.
This comment was marked as outdated.
…ns for the same vulnerability Previously, GitHub was blunty overriding any VulnerableSoftware<->Vulnerability relationships established by OSV, while OSV would just append on what's already there. Using attributions for these relationships, this issue is now solved. The performance impact so far has been minimal, although no real benchmarks have been made. Tests are still a WIP and will be added in a later commit. Signed-off-by: nscuro <nscuro@protonmail.com>
Signed-off-by: nscuro <nscuro@protonmail.com>
src/main/java/org/dependencytrack/persistence/QueryManager.java
Outdated
Show resolved
Hide resolved
src/main/java/org/dependencytrack/persistence/QueryManager.java
Outdated
Show resolved
Hide resolved
src/main/java/org/dependencytrack/persistence/QueryManager.java
Outdated
Show resolved
Hide resolved
Signed-off-by: nscuro <nscuro@protonmail.com>
Signed-off-by: nscuro <nscuro@protonmail.com>
Signed-off-by: nscuro <nscuro@protonmail.com>
Signed-off-by: nscuro <nscuro@protonmail.com>
src/main/java/org/dependencytrack/persistence/VulnerabilityQueryManager.java
Outdated
Show resolved
Hide resolved
src/main/java/org/dependencytrack/persistence/VulnerabilityQueryManager.java
Outdated
Show resolved
Hide resolved
Signed-off-by: nscuro <nscuro@protonmail.com>
src/main/java/org/dependencytrack/persistence/VulnerabilityQueryManager.java
Show resolved
Hide resolved
Signed-off-by: nscuro <nscuro@protonmail.com>
Signed-off-by: nscuro <nscuro@protonmail.com>
Signed-off-by: nscuro <nscuro@protonmail.com>
This is consistent with how other sources do it, and avoids duplicate `VulnerableSoftware` records that end up meaning the same thing. Signed-off-by: nscuro <nscuro@protonmail.com>
src/main/java/org/dependencytrack/persistence/VulnerabilityQueryManager.java
Show resolved
Hide resolved
Signed-off-by: nscuro <nscuro@protonmail.com>
Because the latter throws an exception instead of returning `null` when the object was not found. Signed-off-by: nscuro <nscuro@protonmail.com>
@sahibamittal I updated the PR description with screenshots and some implementation details. |
stevespringett
approved these changes
Nov 15, 2022
nscuro
approved these changes
Nov 15, 2022
nscuro
changed the title
Issue-1815 : handle affected package new versions
Add source attributions for affected component version ranges
Nov 15, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds source attributions for affected component ranges.
Starting with the OSV integration, we now have multiple sources contributing vulnerability intelligence data for the same vulnerability. For example, both the GitHub Advisories and OSV integration may contribute affected version ranges for the same GHSA vulnerability.
By tracking attributions, mirroring tasks are now able to differentiate between affected ranges they previously reported, and those reported by mirroring tasks for other sources. This makes it possible to dynamically prune outdated records, without interfering with other sources' data.
Prior to this PR, the OSV mirroring task would only ever append to the ranges already associated with a given vulnerability, while the GitHub Advisories mirroring task would bluntly replace everything with what was reported by GitHub.
Additionally, this information is exposed via REST API, and displayed in the Affected Components tab of the vulnerability details view:
Users can now see what source reported what, and when.
Addressed Issue
Closes #1815
Additional Details
Internally, Dependency-Track stores version ranges in
VulnerableSoftware
objects. Based on the data mirrored from sources,VulnerableSoftware
records are associated withVulnerability
records, forming an "affected by" relationship.The relationship between
VulnerableSoftware
andVulnerability
is M:N, meaning the sameVulnerableSoftware
record may be associated with multiple vulnerabilities. In fact, some are associated with over 1000 vulns:We investigated adding the attribution fields to the
VULNERABLESOFTWARE_VULNERABILITIES
join table (possible with JDO, see this DataNucleus example). But this resulted in very messy code to maintain and update these relationships, so we decided against doing it this way.Instead, attributions are now a separate object / table that just holds foreign keys to both
Vulnerability
andVulnerableSoftware
. This is similar to the way we handleFindingAttribution
s already.