Skip to content

Add suppress and unsuppress for all projects #4880

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

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

Conversation

rufhe513
Copy link

@rufhe513 rufhe513 commented Apr 25, 2025

Description

This commit introduces functionality to suppress or unsuppress a vulnerability in all projects where the affected component appears. It streamlines bulk vulnerability management across projects, reducing the need for repetitive actions and ensuring consistent analysis state for shared components.

Addressed Issue

closes #1495

Additional Details

This fix identifies the component to be suppressed across all projects in which it appears. It matches components by name and compares their versions. Only components with a version less than or equal to the selected component’s version will be suppressed.
I have also contributed in frontend
DependencyTrack/frontend#1236

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

@owasp-dt-bot
Copy link

owasp-dt-bot commented Apr 25, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

@rufhe513 rufhe513 force-pushed the issue3-final branch 2 times, most recently from 9903454 to db6c363 Compare April 25, 2025 11:04
This commit introduces functionality to suppress or unsuppress a
vulnerability in all projects where the affected component appears.
It streamlines bulk vulnerability management across projects,
reducing the need for repetitive actions and ensuring consistent
analysis state for shared components.

Signed-off-by: rufhe513 <rufhe513@student.liu.se>
Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
-0.05% (target: -1.00%) 73.13% (target: 70.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (7b81bc2) 23968 19319 80.60%
Head commit (100c065) 23989 (+21) 19323 (+4) 80.55% (-0.05%)

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 (#4880) 67 49 73.13%

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

@rkg-mm
Copy link
Contributor

rkg-mm commented Apr 25, 2025

Did I miss something, or would this circumvent ACL permissions? If User A suppresses this in Project A with this flag active, this would suppress the finding also in Project B and C. However, If user does only have permissions on A+B, not on C, he still would alter this for project C. This is a no-go :(

I also have the need for something like this, but this needs more detailed planning I think. The even more important use case for me would e.g. be, to add a vuln analysis to all versions of the same project, but not to completely different projects.

Comment on lines +173 to 188
List<Component> matchingComponents = new ArrayList<>();
if(request.isSuppressAllFlag()) {
List<Project> allProjects = qm.getProjects().getList(Project.class);
for (Project project1 : allProjects) {
List<Component> components = qm.getAllComponents(project1);
for (Component c : components) {
if (c.getName().equals(component.getName()) && c.getVersion().compareTo(component.getVersion()) <= 0) {
matchingComponents.add(c);
}
}
}
} else {
matchingComponents.add(component);
}

String commenter = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks inefficient is it will retrieve all components one-by-one. There also seems to be an assumption that the suppression needs to happen for all versions older than or equal to the version of the component selected for the suppression?

@@ -74,7 +76,8 @@ public AnalysisRequest(@JsonProperty(value = "project") String project,
@JsonProperty(value = "analysisResponse") AnalysisResponse analysisResponse,
@JsonProperty(value = "analysisDetails") String analysisDetails,
@JsonProperty(value = "comment") String comment,
@JsonProperty(value = "isSuppressed") Boolean suppressed) {
@JsonProperty(value = "isSuppressed") Boolean suppressed,
@JsonProperty(value = "suppressAllFlag") Boolean suppressAllFlag) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is a clear enough name, but I think the Flag part should be removed from the name.

@valentijnscholten
Copy link
Contributor

Not sure what the future plans of DT are regarding bulk suppression, but maybe it would be better implemented in the Audit Vulnerabilities view.

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.

system wide vulnerability management
5 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy