Skip to content

Find, verify, and analyze leaked credentials

[chore] - Prevent nil deref panic (#1709)

ahrav0932ea224b5f
diff --git a/pkg/output/legacy_json.go b/pkg/output/legacy_json.go
index 5ea3f1d3d..e6423d044 100644
--- a/pkg/output/legacy_json.go
+++ b/pkg/output/legacy_json.go
@@ -133,7 +133,7 @@ func BranchHeads(repo *gogit.Repository) (map[string]*object.Commit, error) {
}
headCommit, err := repo.CommitObject(*headHash)
if err != nil {
- logger.Error(err, "unable to get commit", "commit", headCommit.String())
+ logger.Error(err, "unable to get commit", "head_hash", headHash.String())
return nil
}
branches[branchName] = headCommit
diff --git a/pkg/sources/github/github.go b/pkg/sources/github/github.go
index de4508e3f..302269083 100644
--- a/pkg/sources/github/github.go
+++ b/pkg/sources/github/github.go
@@ -149,14 +149,16 @@ func (s *Source) newFilteredRepoCache(c cache.Cache, include, exclude []string)
for _, ig := range include {
g, err := glob.Compile(ig)
if err != nil {
- s.log.V(1).Info("invalid include glob", "glob", g, "err", err)
+ s.log.V(1).Info("invalid include glob", "include_value", ig, "err", err)
+ continue
}
includeGlobs = append(includeGlobs, g)
}
for _, eg := range exclude {
g, err := glob.Compile(eg)
if err != nil {
- s.log.V(1).Info("invalid exclude glob", "glob", g, "err", err)
+ s.log.V(1).Info("invalid exclude glob", "exclude_value", eg, "err", err)
+ continue
}
excludeGlobs = append(excludeGlobs, g)
}