mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 05:04:22 +01:00
fix whitelist commits, added test (#390)
This commit is contained in:
1 parent
e0f6399d5c
commit
bdc688dd53
4 files changed
+59
-4
No files matched your search
+8
-4
@@ -282,6 +282,12 @@ func (repo *Repo) Audit() error {
|
||||
return storer.ErrStop
|
||||
}
|
||||
|
||||
// Check if commit is whitelisted
|
||||
if isCommitWhiteListed(c.Hash.String(), repo.config.Whitelist.Commits) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Check if at root
|
||||
if len(c.ParentHashes) == 0 {
|
||||
cc++
|
||||
err = inspectFilesAtCommit(c, repo)
|
||||
@@ -291,11 +297,9 @@ func (repo *Repo) Audit() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
if isCommitWhiteListed(c.Hash.String(), repo.config.Whitelist.Commits) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// increase commit counter
|
||||
cc++
|
||||
|
||||
err = c.Parents().ForEach(func(parent *object.Commit) error {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
|
||||
Reference in new issue
Block a user