Skip to content

Create GraphQL mutation to create Security Policy Project

What does this MR do?

Addresses #329422 (closed)

Introduces a new graphql mutation to create a security policy project for the give project. The newly created project should have:

  1. Protected default branch and not allow direct push to it
  2. All maintainers from the current project should have developer role in the security policy project

Mutation Sample

Mutation
mutation createProject{
  securityPolicyProjectCreate(input:{
    projectPath:"security/tanuki-app"
  }) {
    clientMutationId
    project{
      id
    }
    errors
  }
} 
Response
{
  "data": {
    "securityPolicyProjectCreate": {
      "clientMutationId": null,
      "project": {
        "id": "gid://gitlab/Project/61"
      },
      "errors": []
    }
  }
}

Screenshots (strongly suggested)

Case Screenshot
Successful project creation Screenshot_2021-06-22_at_4.07.33_PM
Security project already exists Screenshot_2021-06-22_at_3.37.42_PM
Created project Screenshot_2021-06-22_at_4.07.44_PM
Protected branch Screenshot_2021-06-22_at_4.08.08_PM

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • 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 Sashi Kumar Kumaresan

Merge request reports

Loading