Skip to content

Fix Secret Detection blob path when scan is run in "no git" mode

James Liu requested to merge jliu-fix-sd-blob-sha into master

What does this MR do and why?

Checks whether the commit.sha value from the Secrets Detection finding is the dummy default SHA before using it to compute the blob path. The dummy value of "0000000" is used when the secrets analyser is executed in "no git" mode, and shouldn't be used to construct the blob path because it won't exist in the repository.

This problem started occurring after !115470 (merged) was merged.

Here's an example finding generated by a secret detection job running on the default branch: https://gitlab.com/jamesliu-gitlab/testing-mr-116908/-/security/vulnerabilities/80221120

The File: badfile-3:1 link under Location is pointing to https://gitlab.com/jamesliu-gitlab/testing-mr-116908/-/blob/0000000/badfile-3#L1 which doesn't exist, because it's put the dummy SHA value of 0000000 into the blob URL.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

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

Edited by James Liu

Merge request reports