mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 13:14:22 +01:00
chore: refine generic-api-key fps + trace logging (#1720)
This commit is contained in:
1 parent
69ed20e25e
commit
a43dc0d3d0
6 files changed
+57
-29
No files matched your search
+8
-7
@@ -57,16 +57,17 @@ type Allowlist struct {
|
||||
}
|
||||
|
||||
// CommitAllowed returns true if the commit is allowed to be ignored.
|
||||
func (a *Allowlist) CommitAllowed(c string) bool {
|
||||
func (a *Allowlist) CommitAllowed(c string) (bool, string) {
|
||||
if c == "" {
|
||||
return false
|
||||
return false, ""
|
||||
}
|
||||
|
||||
for _, commit := range a.Commits {
|
||||
if commit == c {
|
||||
return true
|
||||
return true, c
|
||||
}
|
||||
}
|
||||
return false
|
||||
return false, ""
|
||||
}
|
||||
|
||||
// PathAllowed returns true if the path is allowed to be ignored.
|
||||
@@ -79,14 +80,14 @@ func (a *Allowlist) RegexAllowed(secret string) bool {
|
||||
return anyRegexMatch(secret, a.Regexes)
|
||||
}
|
||||
|
||||
func (a *Allowlist) ContainsStopWord(s string) bool {
|
||||
func (a *Allowlist) ContainsStopWord(s string) (bool, string) {
|
||||
s = strings.ToLower(s)
|
||||
for _, stopWord := range a.StopWords {
|
||||
if strings.Contains(s, strings.ToLower(stopWord)) {
|
||||
return true
|
||||
return true, stopWord
|
||||
}
|
||||
}
|
||||
return false
|
||||
return false, ""
|
||||
}
|
||||
|
||||
func (a *Allowlist) Validate() error {
|
||||
|
||||
Reference in new issue
Block a user