Skip to content

Spike: investigate grouped vulnerability scanners GraphQL queries

This issue is to track the feasibility of creating GraphQL query to return a {Group, InstanceSecurityDashboard,Project}.vulnerabilityScanners

Proposed Solution

Copied from this comment > #368115 (comment 1029586039)

  [
    {
       "name": "some scanner",
       "report_type": "SAST",
       "ids": ["gid://gitlab/Vulnerabilities::Scanner/1", "gid://gitlab/Vulnerabilities::Scanner/2", "gid://gitlab/Vulnerabilities::Scanner/3", ...]
    }
  ]

Application

This will be helpful to populate the data from the tool dropdown

- Project Group Instance
- 2022-07-18_at_1.17_PM 2022-07-18_at_1.18_PM 2022-07-18_at_1.18_PM

Problem

This is to solve the problem that was highlighted in this comment > #368115 (comment 1029693007)

The consolidated query for project/group/project would definitely help with performance and user experience. Especially for larger projects such as GitLab, it might take a bit longer to fetch all the scanners than a grouped response (GitLab group example: 56 total entries vs 9 grouped entries).

Ex: GitLab: https://gitlab.com/-/graphql-explorer

Actual Query
query vulnerabilityScanners {
  project(fullPath: "gitlab-org/gitlab") {
    vulnerabilityScanners {
      nodes {
        id
        name
        reportType
      }
    }
  }
  group(fullPath: "gitlab-org") {
    vulnerabilityScanners {
      nodes {
        id
        name
        reportType
      }
    }
  }
  instanceSecurityDashboard {
    vulnerabilityScanners {
      nodes {
        id
        name
        reportType
      }
    }
  }
}
GitLab Total items (current API response) Actual items needed (after grouping) Sample Data
gitlab-org/gitlab (Project) 16 4 2022-07-18_at_5.09_PM
gitlab-org (Group) 56 9 -
Edited by Samantha Ming