Skip to content

Enable securityReportFindings GraphQL to retrieve scanners

What does this MR do and why?

This MR fixes the PipelineVulnerabilitiesFinder to include the project_id in the scanner for the findings. This is necessary for the securityReportFindings GraphQL field to respond with the scanner data, as the `ScannerPolicy authorization is delegated to the project authorization.

Screenshots or screen recordings

Before

Screen_Shot_2022-11-02_at_3.58.12_PM

After

Screen_Shot_2022-11-02_at_4.03.26_PM

How to set up and validate locally

  1. Check out the master branch
  2. Make the following GraphQL call
query pipelineFindings {
  project(fullPath: "<project path>") {
    pipeline(iid:"<pipeline IID>") {
      securityReportFindings(first:1) {
        nodes {
          scanner {
            name
          }
        }
      }
    }
  }
}
  1. The scanner should be null
{
  "data": {
    "project": {
      "pipeline": {
        "securityReportFindings": {
          "nodes": [
            {
              "scanner": null
            }
          ]
        }
      }
    }
  }
}
  1. Check out this branch
  2. Make the call again
  3. The scanner should not be null
{
  "data": {
    "project": {
      "pipeline": {
        "securityReportFindings": {
          "nodes": [
            {
              "scanner": "<scanner name>"
            }
          ]
        }
      }
    }
  }
}

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #368601 (closed)

Edited by Jonathan Schafer

Merge request reports