Skip to content

Show vulnerable lines of file on vulnerability details page

What does this MR do and why?

This MR shows the vulnerable lines in the file on the vulnerablity details page, if the vulnerability was found in a file and there is a start line. If there was an error loading the file contents, an error will be shown. If the file was not found, a warning will be shown (this matches the behavior of what happens when you try to view a file that doesn't exist).

File contents Loading error File not found warning
ksnip_20230803-163412 ksnip_20230803-163825 ksnip_20230803-163753
Peek_2023-08-03_23-20

How to set up and validate locally

  1. Clone this project: https://gitlab.com/gitlab-org/security-products/tests/webgoat.net
  2. Run a pipeline against the master branch.
  3. Go to the vulnerability report and click on any vulnerability.
  4. Verify that the file contents are shown.
  5. To verify the warning state, clone this project: https://gitlab.com/gitlab-examples/security/security-reports and do the same as above, but for a SAST vulnerability. The report has dummy data, so the files don't exist in the project.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #418856 (closed)

Edited by Daniel Tian

Merge request reports