in gitlab gitleaks security scan ~ read.
Fixing "Gitleaks analysis failed" issue in Gitlab pipeline

Fixing "Gitleaks analysis failed" issue in Gitlab pipeline

In New10 we have recently moved our security scans from Snyk to Security scanner integration. Recently, when i was integrating this with another service, i got this error

[INFO] [secrets] [2020-12-31T08:17:48Z] ▶ GitLab secrets analyzer v3.13.1
[INFO] [secrets] [2020-12-31T08:17:48Z] ▶ Running scan from commits file 06efd4ca11ae36382f34720e9eae3e1e6e0_commit_list.txt 
on commits 06efd4ca11ae36382f3472ea9210e9eae3e1e6e0
[ERRO] [secrets] [2020-12-31T08:17:50Z] ▶ Couldn't run the gitleaks command: exit status 2
[ERRO] [secrets] [2020-12-31T08:17:50Z] ▶ Gitleaks analysis failed: exit status 2

Well, such errors make everything so clear, right ? :)


Thanks to my colleagues, i was able to fix this. The only thing you need to do is in your .gitlab-ci.yml file add next variable:

    GIT_DEPTH: '2' # Tells git to fetch all the branches of the project, required by the analysis task

That should do the trick. Hope i help someone besides me ( I will definatelly will come back to this post in the future :) )

comments powered by Disqus
comments powered by Disqus