Fix rendering of file location when blob-path and line numbers are empty
What does this MR do and why?
The standalone security finding modal currently renders a link to a file-location, even if there is no link to the file (blobPath
field is used for the link) coming from the GraphQL API. It also renders undefined
as line number markers.
This MR fixes the behavior and only renders the link (and line numbers) when they contain values.
Screenshots or screen recordings
before | after |
---|---|
How to set up and validate locally
Setup
- Have the related FF enabled:
echo "Feature.enable(:standalone_finding_modal)" | rails c
- You'll need an EE License
- You'll need to have runners enabled (See $2408961 for setting up a runner)
- Import https://gitlab.com/gitlab-examples/security/security-reports
- Run a pipeline on master
Validation
- Go to the pipeline's security report tab
- Set Filter: Tool -> SAST
- Click on a finding
- Verify that Location -> File does not render a broken link or
undefined
as a line number
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by David Pisek