mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 12:44:22 +01:00
more info on output and in jsonish format
This commit is contained in:
1 parent
aa15ded5c4
commit
2186f22999
5 files changed
+46
-29
No files matched your search
@@ -5,22 +5,32 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func doChecks(diff string) []string {
|
||||
// checks Regex and if enabled, entropy and stopwords
|
||||
func doChecks(diff string, commit string) []LeakElem {
|
||||
var match string
|
||||
var results []string
|
||||
var leaks []LeakElem
|
||||
var leak LeakElem
|
||||
lines := strings.Split(diff, "\n")
|
||||
for _, line := range lines {
|
||||
for _, re := range regexes {
|
||||
for leakType, re := range regexes {
|
||||
match = re.FindString(line)
|
||||
if len(match) == 0 ||
|
||||
(opts.Strict && containsStopWords(line)) ||
|
||||
(opts.Entropy && !checkShannonEntropy(line)) {
|
||||
continue
|
||||
}
|
||||
results = append(results, line)
|
||||
|
||||
leak = LeakElem{
|
||||
Line: line,
|
||||
Commit: commit,
|
||||
Offender: match,
|
||||
Reason: leakType,
|
||||
}
|
||||
|
||||
leaks = append(leaks, leak)
|
||||
}
|
||||
}
|
||||
return results
|
||||
return leaks
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user