mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 12:44:22 +01:00
check whiteListFiles for root commit & GitHub PRs
add missing checks against `whiteListFiles` regexes for files in the root/initial commit and in GitHub PRs (in `auditGithubPR` function)
This commit is contained in:
2 files changed
+19
No files matched your search
@@ -509,6 +509,12 @@ func auditGitReference(repo *RepoDescriptor, ref *plumbing.Reference) []Leak {
|
||||
if bin || err != nil {
|
||||
return nil
|
||||
}
|
||||
for _, re := range whiteListFiles {
|
||||
if re.FindString(f.Name) != "" {
|
||||
log.Infof("skipping whitelisted file (matched regex '%s'): %s", re.String(), f.Name)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
content, err := f.Contents()
|
||||
if err != nil {
|
||||
return nil
|
||||
@@ -578,7 +584,9 @@ func auditGitReference(repo *RepoDescriptor, ref *plumbing.Reference) []Leak {
|
||||
}
|
||||
for _, re := range whiteListFiles {
|
||||
if re.FindString(filePath) != "" {
|
||||
log.Infof("skipping whitelisted file (matched regex '%s'): %s", re.String(), filePath)
|
||||
skipFile = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if skipFile {
|
||||
|
||||
Reference in new issue
Block a user