mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 04:34:46 +01:00
fix deduplication issue caused by clobbered findings (#742)
* fix deduplication issue caused by clobbered findings * fix index * remove indexing, slow is better than wrong
This commit is contained in:
1 parent
84e285e4ce
commit
ce42947cae
17 files changed
+81
-66
No files matched your search
+3
-3
@@ -15,8 +15,8 @@ import (
|
||||
// FromGit accepts a gitdiff.File channel (structure output from `git log -p`) and a configuration
|
||||
// struct. Files from the gitdiff.File channel are then checked against each rule in the configuration to
|
||||
// check for secrets. If any secrets are found, they are added to the list of findings.
|
||||
func FromGit(files <-chan *gitdiff.File, cfg config.Config, outputOptions Options) []*report.Finding {
|
||||
var findings []*report.Finding
|
||||
func FromGit(files <-chan *gitdiff.File, cfg config.Config, outputOptions Options) []report.Finding {
|
||||
var findings []report.Finding
|
||||
mu := sync.Mutex{}
|
||||
wg := sync.WaitGroup{}
|
||||
commitMap := make(map[string]bool)
|
||||
@@ -82,7 +82,7 @@ func FromGit(files <-chan *gitdiff.File, cfg config.Config, outputOptions Option
|
||||
printFinding(fi)
|
||||
}
|
||||
mu.Lock()
|
||||
findings = append(findings, &fi)
|
||||
findings = append(findings, fi)
|
||||
mu.Unlock()
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user