mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-27 11:44:23 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
35531233d9 | ||
|
|
54949bd62a |
No files matched your search
@@ -1,6 +1,11 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
1.19.3
|
||||
----
|
||||
- memoizing root commit
|
||||
- only count commits (not commit + parent) for total commit number
|
||||
|
||||
1.19.2
|
||||
----
|
||||
- fixed a bug where gitleaks was skipping the initial commit
|
||||
|
||||
+9
-9
@@ -454,6 +454,14 @@ func TestAuditRepo(t *testing.T) {
|
||||
whiteListRegexes []*regexp.Regexp
|
||||
configPath string
|
||||
}{
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "commit depth = 1, one leak",
|
||||
numLeaks: 1,
|
||||
testOpts: Options{
|
||||
Depth: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "two leaks present",
|
||||
@@ -557,14 +565,6 @@ func TestAuditRepo(t *testing.T) {
|
||||
Commit: "f6839959b7bbdcd23008f1fb16f797f35bcd3a0c",
|
||||
},
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "commit depth = 1, one leak",
|
||||
numLeaks: 2,
|
||||
testOpts: Options{
|
||||
Depth: 1,
|
||||
},
|
||||
},
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "commit depth = 2, two leaks",
|
||||
@@ -576,7 +576,7 @@ func TestAuditRepo(t *testing.T) {
|
||||
{
|
||||
repo: leaksRepo,
|
||||
description: "toml entropy range",
|
||||
numLeaks: 354,
|
||||
numLeaks: 298,
|
||||
configPath: path.Join(configsDir, "entropy"),
|
||||
},
|
||||
{
|
||||
|
||||
@@ -133,7 +133,7 @@ type entropyRange struct {
|
||||
}
|
||||
|
||||
const defaultGithubURL = "https://api.github.com/"
|
||||
const version = "1.19.2"
|
||||
const version = "1.19.3"
|
||||
const errExit = 2
|
||||
const leakExit = 1
|
||||
const defaultConfig = `
|
||||
@@ -460,6 +460,7 @@ func auditGitReference(repo *RepoDescriptor, ref *plumbing.Reference) []Leak {
|
||||
cIter.Close()
|
||||
return errors.New("ErrStop")
|
||||
}
|
||||
commitCount = commitCount + 1
|
||||
if whiteListCommits[c.Hash.String()] {
|
||||
log.Infof("skipping commit: %s\n", c.Hash.String())
|
||||
return nil
|
||||
@@ -467,6 +468,15 @@ func auditGitReference(repo *RepoDescriptor, ref *plumbing.Reference) []Leak {
|
||||
|
||||
// commits w/o parent (root of git the git ref)
|
||||
if len(c.ParentHashes) == 0 {
|
||||
if commitMap[c.Hash.String()] {
|
||||
return nil
|
||||
}
|
||||
cMutex.Lock()
|
||||
commitMap[c.Hash.String()] = true
|
||||
cMutex.Unlock()
|
||||
|
||||
totalCommits = totalCommits + 1
|
||||
|
||||
fIter, err := c.Files()
|
||||
if err != nil {
|
||||
return nil
|
||||
@@ -502,7 +512,7 @@ func auditGitReference(repo *RepoDescriptor, ref *plumbing.Reference) []Leak {
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
skipCount := false
|
||||
err = c.Parents().ForEach(func(parent *object.Commit) error {
|
||||
// check if we've seen this diff before
|
||||
if commitMap[c.Hash.String()+parent.Hash.String()] {
|
||||
@@ -511,8 +521,11 @@ func auditGitReference(repo *RepoDescriptor, ref *plumbing.Reference) []Leak {
|
||||
cMutex.Lock()
|
||||
commitMap[c.Hash.String()+parent.Hash.String()] = true
|
||||
cMutex.Unlock()
|
||||
commitCount = commitCount + 1
|
||||
totalCommits = totalCommits + 1
|
||||
|
||||
if !skipCount {
|
||||
totalCommits = totalCommits + 1
|
||||
skipCount = true
|
||||
}
|
||||
|
||||
commitWg.Add(1)
|
||||
semaphore <- true
|
||||
|
||||
Reference in new issue
Block a user