Instance level exportable security reports api changes

Why this MR?

This MR is related to issue #213014 (closed).

What does this MR do?

This MR is adding /security namespace for the existing vulnerability export endpoints and removing the /project/:project_id namespace from the existing lookup endpoints as we are going to use the same endpoint for all type of exports and also introducing a new endpoint to create instance level exports.

Old Endpoint New Endpoint
POST /projects/:project_id/vulnerability_exports POST /security/projects/:project_id/vulnerability_exports
N/A POST /security/vulnerability_exports
GET /projects/:project_id/vulnerability_exports/:export_id GET /security/vulnerability_exports/:export_id
GET /projects/:project_id/vulnerability_exports/:export_id/download GET /security/vulnerability_exports/:export_id/download

Note: The response payload is the same as before.

Creating an instance level export

Example HTTP request;

curl --request POST '${BASE_URL}/api/v4/security/vulnerability_exports' \
     --header 'PRIVATE_TOKEN: ${TOKEN}'

Example response payload;

    "id": 2,
    "created_at": "2020-04-27T12:45:41.133Z",
    "project_id": null,
    "format": "csv",
    "status": "created",
    "started_at": null,
    "finished_at": null,
    "_links": {
        "self": "http://gitlab.local:3000/api/v4/security/vulnerability_exports/2",
        "download": "http://gitlab.local:3000/api/v4/security/vulnerability_exports/2/download"

Does this MR meet the acceptance criteria?


Availability and Testing


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 Mehmet Emin INAC