Unlink MR and vulnerability mutation
What does this MR do and why?
Add a mutation for unlinking an MR from a vulnerability.
In !202437 (merged) we added the mutation for linking an MR to a vulnerability. This MR is adding the mutation for unlinking.
References
Related to #503408
Screenshots or screen recordings
How to set up and validate locally
- Navigate to a project with a vulnerability. If you need to seed a project, you can do so with 
bin/rake 'gitlab:seed:vulnerabilities[<your-project-path>]' - Create an MR and get the GID from dev tools (the UI only shows the IID)
 - In the graphql explorer 
/-/graphql-explorermake the following mutation to link the MR to a vulnerability 
mutation linkMergeRequest {
  vulnerabilityLinkMergeRequest(input: {
    vulnerabilityId: "gid://gitlab/Vulnerability/<your-vulnerability-gid>",
    mergeRequestId: "gid://gitlab/MergeRequest/<your-MR-gid>"
  }) {
    vulnerability {
      id
      mergeRequest {
        id
        title
      }
      mergeRequests {
        nodes {
          id
          title
        }
      }
    }
  }
}
- You can double check that the merge request was linked to the vulnerability by making another query
 
query getVulnerability {
  vulnerability(id: "gid://gitlab/Vulnerability/<your-vulnerability-gid>") {
    id
    mergeRequest {
      id
      title
    }
    mergeRequests {
      nodes {
        id
        title
      }
    }
  }
}
- Now make the following mutation to unlink the MR from the vulnerability
 
mutation unlinkMergeRequest {
  vulnerabilityUnlinkMergeRequest(input: {
    vulnerabilityId: "gid://gitlab/Vulnerability/<your-vulnerability-gid>",
    mergeRequestId: "gid://gitlab/MergeRequest/<your-MR-gid>"
  }) {
    vulnerability {
      id
      mergeRequest {
        id
        title
      }
      mergeRequests {
        nodes {
          id
          title
        }
      }
    }
  }
}
- Verify that the MR is no longer linked to the vulnerability
 
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited  by Scott Hampton
