Mark CVS vulnerabilities as no longer detected
What does this MR do and why?
Since Continuous Vulnerability Scanning creates vulnerabilities using the scanner name GitLab SBoM Vulnerability Scanner
and the CI based scans use the scanner name Gemnasium
, the current logic doesn't apply the "no longer detected in default branch" flag to such vulnerabilities created by CVS.
To fix this, this MR adjusts the MarkAsResolvedService to additionally process vulnerabilities with scanner GitLab SBoM Vulnerability Scanner
when ingesting vulnerabilities from a Dependency Scanning or Container Scanning scanner, since these are the 2 types that are currently supported by CVS.
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Demo: https://youtu.be/A_nlojniDms
Pre-requisite: Enable CVS in your GDK. The data sync might take a while.
- clone/fork https://gitlab.com/gitlab-org/secure/tests/olivier/cvs-vulnerabilities-not-marked on your GDK
- add puma@6.3.1 dependency (make sure to update the
Gemfile.lock
too) - run CVS logic via the rails console to create a vulnerability for puma (this will actually override the "scaner" value for the one alread created by the Dependency Scanning CI job):
advisory_id=PackageMetadata::Advisory.where("identifiers @> ?", [{name: 'CVE-2024-21647'}].to_json).where(source_xid: "glad").first.id advisory = advisory=PackageMetadata::Advisory.with_affected_packages.find_by_id advisory_id PackageMetadata::AdvisoryScanService.execute(advisory)
- verify the puma vulnerability is reported with the scanner:
GitLab SBoM Vulnerability Scanner
- update puma version to
6.4.2
(bothGemfile
andGemfile.lock
) - verify the puma vulnerability is marked as no longer detected on the default branch
Numbered steps to set up and validate the change are strongly suggested.
Related to #441490 (closed)