Find, verify, and analyze leaked credentials
Go credentialsdevsecopsdynamic-analysisprecommitscanningsecretsecret-managementsecretssecuritysecurity-toolstrufflehogverification
Scan commit in since-commit (#416)
Bill Rich1f55171437fa
diff --git a/pkg/sources/git/git.go b/pkg/sources/git/git.goindex c3d86e64f..e13335040 100644--- a/pkg/sources/git/git.go+++ b/pkg/sources/git/git.go@@ -277,6 +277,7 @@ func (s *Git) ScanCommits(repo *git.Repository, path string, scanOptions *ScanOpurlMetadata := getSafeRemoteURL(repo, "origin")var depth int64+ var reachedBase = falsefor file := range fileChan {log.WithField("commit", file.PatchHeader.SHA).WithField("file", file.NewName).Trace("Scanning file from git")if scanOptions.MaxDepth > 0 && depth >= scanOptions.MaxDepth {@@ -284,10 +285,13 @@ func (s *Git) ScanCommits(repo *git.Repository, path string, scanOptions *ScanOpbreak}depth+++ if reachedBase && file.PatchHeader.SHA != scanOptions.BaseHash {+ break+ }if len(scanOptions.BaseHash) > 0 {if file.PatchHeader.SHA == scanOptions.BaseHash {- log.Debugf("reached base commit")- break+ log.Debugf("Reached base commit. Finishing scanning files.")+ reachedBase = true}}if !scanOptions.Filter.Pass(file.NewName) {