mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-28 12:14: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
@@ -51,9 +51,20 @@ func auditGithubPR() ([]Leak, error) {
|
||||
}
|
||||
files := commit.Files
|
||||
for _, f := range files {
|
||||
skipFile := false
|
||||
if f.Patch == nil || f.Filename == nil {
|
||||
continue
|
||||
}
|
||||
for _, re := range whiteListFiles {
|
||||
if re.FindString(f.GetFilename()) != "" {
|
||||
log.Infof("skipping whitelisted file (matched regex '%s'): %s", re.String(), f.GetFilename())
|
||||
skipFile = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if skipFile {
|
||||
continue
|
||||
}
|
||||
|
||||
diff := gitDiff{
|
||||
sha: commit.GetSHA(),
|
||||
|
||||
Reference in new issue
Block a user