mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 21:44:23 +01:00
Merge pull request #112 from zricethezav/wl-commit
look at prev commit too
This commit is contained in:
2 files changed
+10
-6
No files matched your search
+2
-6
@@ -500,14 +500,12 @@ func TestAuditRepo(t *testing.T) {
|
|||||||
numLeaks: 0,
|
numLeaks: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// note this double counts the first commit since we are whitelisting
|
|
||||||
// a "bad" first commit
|
|
||||||
repo: leaksRepo,
|
repo: leaksRepo,
|
||||||
description: "two leaks present whitelist bad commit",
|
description: "two leaks present whitelist bad commit",
|
||||||
whiteListCommits: map[string]bool{
|
whiteListCommits: map[string]bool{
|
||||||
"eaeffdc65b4c73ccb67e75d96bd8743be2c85973": true,
|
"eaeffdc65b4c73ccb67e75d96bd8743be2c85973": true,
|
||||||
},
|
},
|
||||||
numLeaks: 2,
|
numLeaks: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
repo: leaksRepo,
|
repo: leaksRepo,
|
||||||
@@ -539,12 +537,10 @@ func TestAuditRepo(t *testing.T) {
|
|||||||
numLeaks: 0,
|
numLeaks: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// note this double counts the first commit since we are whitelisting
|
|
||||||
// a "bad" first commit
|
|
||||||
repo: leaksRepo,
|
repo: leaksRepo,
|
||||||
description: "toml whitelist commit",
|
description: "toml whitelist commit",
|
||||||
configPath: path.Join(configsDir, "commit"),
|
configPath: path.Join(configsDir, "commit"),
|
||||||
numLeaks: 2,
|
numLeaks: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
repo: leaksRepo,
|
repo: leaksRepo,
|
||||||
|
|||||||
@@ -466,6 +466,14 @@ func auditGitReference(repo *RepoDescriptor, ref *plumbing.Reference) []Leak {
|
|||||||
log.Infof("skipping commit: %s\n", c.Hash.String())
|
log.Infof("skipping commit: %s\n", c.Hash.String())
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if prevCommit != nil {
|
||||||
|
if whiteListCommits[prevCommit.Hash.String()] {
|
||||||
|
prevCommit = c
|
||||||
|
log.Infof("skipping commit: %s\n", c.Hash.String())
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
commitWg.Add(1)
|
commitWg.Add(1)
|
||||||
semaphore <- true
|
semaphore <- true
|
||||||
go func(c *object.Commit, prevCommit *object.Commit) {
|
go func(c *object.Commit, prevCommit *object.Commit) {
|
||||||
|
|||||||
Reference in new issue
Block a user