Implement GraphQL query to generate JSON for SAST config UI

Problem to Solve

Generate JSON by reading config_ui_schema.json file described in this issue so that it can be used in rendering SAST config UI.

Implementation Plan

  • Implement a graphQL API query with new type and resolver in ee/app/graphql. The query should look as follows: Sample Query:
{
  project(fullPath: "root/demo-historic-secrets") {
    sastCiConfiguration {
      nodes {
        scanTypes
        analyzer
        docLink
        variableName
        currentValue
        defaultValue
        shortName
        description
        availableValues
        type
      }
    }
  }
}

Sample Result:

{
  "data": {
    "project": {
      "sastCiConfiguration": {
        "nodes": [
          {
            "scanTypes": [
              "sast",
              "secret_detection",
              "dependency_scanning"
            ],
            "analyzer": "all",
            "docLink": "...",
            "variableName": "SECURE_ANALYZERS_PREFIX",
            "currentValue": null,
            "defaultValue": "registry.gitlab.com/gitlab-org/security-products/analyzers",
            "shortName": "Image prefix",
            "description": "Overrides the name of the Docker registry providing the default images",
            "availableValues": [],
            "type": "string"
          },
          {
            "scanTypes": [
              "sast"
            ],
            "analyzer": "all",
            "docLink": "...",
            "variableName": "SAST_ANALYZER_IMAGE_TAG",
            "currentValue": null,
            "defaultValue": "2",
            "shortName": "Image tag",
            "description": "Overrides the Docker tag of the default images",
            "availableValues": [],
            "type": "string"
          },
          {
            "scanTypes": [
              "sast"
            ],
            "analyzer": "kubesec",
            "docLink": "...",
            "variableName": "SCAN_KUBERNETES_MANIFESTS",
            "currentValue": null,
            "defaultValue": "false",
            "shortName": "",
            "description": "",
            "availableValues": null,
            "type": "boolean"
          }
        ]
      }
    }
  }
}
Edited by Saikat Sarkar