Skip to content
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

Avoid duplicates with alias BACKEND #3685

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

LaVibeX
Copy link
Contributor

@LaVibeX LaVibeX commented May 8, 2024

Description

This PR introduces a new functionality that addresses the issue of duplicate vulnerabilities by comparing the priority of sources and the aliases attached to a component.

The implementation required adding new database rows to support the changes.

To ensure the correctness of the implementation, tests have been added to validate the behavior of the updated functionality.

In addition, a new API endpoint has been added to get the actual Enabled Sources.

It is important to note that this update specifically affects the addVulnerability function and is not able to delete a vulnerability in any case.

Fronted changes: DependencyTrack/frontend#838
I'm open to discussing any changes or improvements👍🏽

Examples:

  1. Alias Deduplication Disabled
    image

  2. Vulnerability source with highest priority: NVD
    image

  3. Vulnerability source with highest priority: GITHUB
    image

Addressed Issue

This PR fixes #1994 and #2181

Additional Details

Add a new file named ConfigPropertyQueryManager.java to manage functions related to the EnabledSources

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 added corresponding update logic
  • This PR introduces new or alters existing behavior, and I have updated the documentation accordingly

This commit introduces a new functionality that addresses the issue of duplicate vulnerabilities
by comparing the priority of sources and the aliases attached to a component.

The implementation required adding new database rows to support the changes.

To ensure the correctness of the implementation, tests have been added to validate the behavior of the updated functionality.

In addition, a new API endpoint has been added to get the actual Enabled Sources.

It is important to note that this update specifically affects the addVulnerability function
and is not able to delete a vulnerability in any case.

Signed-off-by: Andres Tito <andres.tito@rohde-schwarz.com>
@valentijnscholten
Copy link
Contributor

Not sure if I fully understand the PR. Does it only one vulnerability, the one from the source with the highest priority?

It feels to me that this would be a "bolt on" solution to a database model that should be changed. Wouldn't it be better to have data model that has one vulnerability that can have multiple aliases (from different sources possibly)? Currently with multiple aliases/sources there are (can be / most often are) multiple rows of vulnerabilities. This makes a lot of things harder and more complicated. For example determining the number of affected project for a vulnerability or something "as simple as" sorting the list of vulnerabilities by number of affected projects.

@LaVibeX
Copy link
Contributor Author

LaVibeX commented May 10, 2024

Not sure if I fully understand the PR. Does it only one vulnerability, the one from the source with the highest priority?

It feels to me that this would be a "bolt on" solution to a database model that should be changed. Wouldn't it be better to have data model that has one vulnerability that can have multiple aliases (from different sources possibly)? Currently with multiple aliases/sources there are (can be / most often are) multiple rows of vulnerabilities. This makes a lot of things harder and more complicated. For example determining the number of affected project for a vulnerability or something "as simple as" sorting the list of vulnerabilities by number of affected projects.

PR Description updated: I hope that with the example images the PR will be better explained @valentijnscholten

… I remove it for now, issues with isEmpty, better use != null

Signed-off-by: Andres Tito <andres.tito@rohde-schwarz.com>
Copy link

codacy-production bot commented May 15, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.10% (target: -1.00%) 93.46% (target: 70.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (db58e69) 21630 16377 75.71%
Head commit (846d2dd) 21736 (+106) 16478 (+101) 75.81% (+0.10%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#3685) 107 100 93.46%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy will stop sending the deprecated coverage status from June 5th, 2024. Learn more

…y-track into AvoidDuplicatesWithAlias

Signed-off-by: Andres Tito <andres.tito@rohde-schwarz.com>
@pkunze
Copy link

pkunze commented May 17, 2024

I think this might also solve #2181 would be greatly appreciated :) 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Offer alias-based de-duplication of vulnerabilities
3 participants