Skip to content

Backend: Add hasRemediations filter to Vulnerability Report

Why are we doing this work

This is the backend issue to add hasRemediations:boolean parameter to the vulnerabilities query.

query {
  project(fullPath: "gitlab-org/gitlab") {
    vulnerabilities(reportType:DEPENDENCY_SCANNING, hasRemediations:true) {
      nodes {
        hasRemediations
      }
    }
  }
}

Relevant links

Non-functional requirements

  • Documentation: Update GraphQL docs
  • Performance: Need to see how this would affect the performance of vulnerability_reads
  • Testing: New tests will need to be added
  • E2E testing: Make sure e2e: package-and-test is run and govern specs are green

Implementation plan

This issue is going to require multiple MRs (pending some discussion with the backend team on vulnerabiity_reads usage):

  • database MR 1: Add has_remediations column to vulnerability_reads table
  • database MR 2: Update trigger in database for has_remediations field
    • Use the trigger for other vulnerability fields as an example for this
  • database MR 3: Backfill has_remediations column with background migration

database implementations are tracked in #420617 (closed)

  • backend : Add has_remediations relation to Vulnerabilities::Read model
  • backend : Add has_remediations filter to VulnerabilityReadsFinder
  • backend : Add hasRemediations field and argument to vulnerabilities query
  • backend : Add hasRemediations field and argument to VulnerabilitySeveritiesCount query

backend implementations are tracked in this issue.

Once MR 1 is completed, MR groups 2/3 and 4/5/6 can be done in parallel

Verification steps

Edited by Subashis Chakraborty