Skip to content

Remove scannerType argument from Mutations::Vulnerabilities::Create

Michał Zając requested to merge 10272-remove-scanner-type-argument into master

What does this MR do?

When verifying work done on Directly create vulnerability records via API it came to our attention that the mutation accepts an superfluous argument – scannerType

Screenshot

image

How to setup and validate locally (strongly suggested)

  1. Enable the invite modal
    Feature.enable(:create_vulnerabilities_via_api)
  2. Go to GraphQL Explorer http://127.0.0.1:3000/-/graphql-explorer
  3. Try supplying scannerType as an argument to the mutation
mutation vulnerabilityCreate($input: VulnerabilityCreateInput!) {
  vulnerabilityCreate(input: $input) {
    errors
    clientMutationId
    vulnerability: vulnerability {
      id
      vulnerabilityPath
      project {
        id
        fullPath
      }
    }
  }
}
{
  "input": {
    "project": "gid://gitlab/Project/6102100",
    "title": "A manual vulnerability number 2",
    "description": "A descriptive description",
    "scannerType": "SAST",
    "scannerName": "Thiago",
    "state": "CONFIRMED",
    "identifiers": [
      {
      	"name": "CVE-3",
      	"url": "http://localhost"
    	}
    ]
  }
}

It should complain about VulnerabilityCreateInput not having a scannerType field.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Merge request reports