Skip to content

Draft: Support transforming GitLab SAST Report to SARIF

Hua Yan requested to merge hyan-vet-sarif into main

What does this MR do?

Currently SARIF format support is only one way, i.e., transforming a sarif file to a GitLab SAST Report.

Relating to #452028, it would nice if GitLab SAST Report can be transformed to SARIF (with an implementation plan).

This MR extends current sarif.go by

  1. Adding a function that transforms a GitLab SAST Report (the physical file) to SARIF;
  2. Adding a function that transforms a GitLab SAST Report (data structure in memory) to SARIF;
  3. Exporting Sarif type to allow other projects (e.g., VET) to possibly modify its Sarif output.

Testing:

  1. Corresponding test is added
  2. The validity of generated sarif file has been tested on the Sarif website.

What are the relevant issue numbers?

https://gitlab.com/gitlab-org/gitlab/-/issues/452028+s

Does this MR meet the acceptance criteria?

Edited by Hua Yan

Merge request reports