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?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
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