Skip to content

Add vulnerabilityGrades to GraphQL API

What does this MR do?

Related to #213623 (closed)

This change adds new field to Group and InstanceSecurityDashboard types, with this change user is able to fetch list of projects grouped by security grade and fetch count for each group:

query {
  instanceSecurityDashboard {
    vulnerabilityGrades {
      grade
      projects {
        nodes {
          id
          name
        }
      }
    }
  }
  group(fullPath: "root1") {
  	vulnerabilityGrades {
      grade
      projects {
        nodes {
          id
          name
        }
      }
    }
  }
}

Response

{
  "data": {
    "instanceSecurityDashboard": {
      "vulnerabilityGrades": [
        {
          "grade": "D",
          "projects": {
            "nodes": [
              {
                "id": "gid://gitlab/Project/19",
                "name": "Security Reports"
              }
            ]
          }
        }
      ]
    },
    "group": {
      "vulnerabilityGrades": [
        {
          "grade": "D",
          "projects": {
            "nodes": [
              {
                "id": "gid://gitlab/Project/19",
                "name": "Security Reports"
              }
            ]
          }
        }
      ]
    }
  }
}

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Alan (Maciej) Paruszewski

Merge request reports