Skip to content

Find, verify, and analyze leaked credentials

Handle nil file channel (#417)

Dustin Decker879e65b5c5d7
diff --git a/pkg/sources/git/git.go b/pkg/sources/git/git.go
index 862462b37..54648aeee 100644
--- a/pkg/sources/git/git.go
+++ b/pkg/sources/git/git.go
@@ -272,6 +272,10 @@ func (s *Git) ScanCommits(repo *git.Repository, path string, scanOptions *ScanOp
if err != nil {
return errors.WrapPrefix(err, "could not open repo path", 0)
}
+ // parser can return nil chan and nil error
+ if fileChan == nil {
+ return errors.New("nothing to scan")
+ }
// get the URL metadata for reporting (may be empty)
urlMetadata := getSafeRemoteURL(repo, "origin")