Allow to filter vulnerabilities by image name on the project dashboard - Backend
Main issue
This is the backend part for #215467 (closed)
Problem to solve
Improve UX when multiple images are reporting Container Scanning findings (or vulnerabilities when dashboard gets converted to standalone vulnerabilities)
Intended users
Further details
Proposal
-
Add a new docker_imagecolumn to thevulnerability_occurrencestable -
Migrate all existing entries in the vulnerability_occurrencestable so they have a validdocker_imagevalue.Decide if we should store the full registry URI of the image, or only the
basename, for example, which of the following should be stored?registry.gitlab.com/adamcohen/container-scanning-multi-image/alpine1-test-two-same-imagesalpine1-test-two-same-images
If we store the full registry URI, we can always truncate it in the UI, but if we don't store enough information from the beginning, it won't be possible to recreate it later on.
-
When a pipeline is run, store the Docker image name in the docker_imagecolumn of thevulnerability_occurrencestable. -
Add a new ProjectVulnerabilityFindingsActionsendpoint, such asdocker_images, to return the images related to a given project and pipeline. -
Update ProjectVulnerabilityFindingsActions.indexaction to allow filtering based ondocker_imagevalue, so only vulnerabilities matching this image will be returned.