mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 21:24:21 +01:00
external repo file support
This commit is contained in:
1 parent
2c80ad5ea9
commit
ccef3680d5
6 files changed
+96
-15
No files matched your search
@@ -22,7 +22,6 @@ func doChecks(diff string, commit Commit, repo *Repo) []Leak {
|
||||
file = line[idx[1]:]
|
||||
}
|
||||
}
|
||||
|
||||
for leakType, re := range regexes {
|
||||
match = re.FindString(line)
|
||||
if len(match) == 0 ||
|
||||
@@ -44,6 +43,31 @@ func doChecks(diff string, commit Commit, repo *Repo) []Leak {
|
||||
}
|
||||
leaks = append(leaks, leak)
|
||||
}
|
||||
|
||||
// Check for external regex matches
|
||||
if externalRegex != nil {
|
||||
for _, re := range externalRegex {
|
||||
match = re.FindString(line)
|
||||
if len(match) == 0 ||
|
||||
(opts.Strict && containsStopWords(line)) ||
|
||||
(opts.Entropy && !checkShannonEntropy(line, opts)) {
|
||||
continue
|
||||
}
|
||||
|
||||
leak = Leak{
|
||||
Line: line,
|
||||
Commit: commit.Hash,
|
||||
Offender: match,
|
||||
Reason: "match: " + re.String(),
|
||||
Msg: commit.Msg,
|
||||
Time: commit.Time,
|
||||
Author: commit.Author,
|
||||
File: file,
|
||||
RepoURL: repo.url,
|
||||
}
|
||||
leaks = append(leaks, leak)
|
||||
}
|
||||
}
|
||||
}
|
||||
return leaks
|
||||
|
||||
|
||||
Reference in new issue
Block a user