mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 04:34:46 +01:00
Keyword (#825)
* wip keywords optimization * update readme * limit concurrency to 4 * update readme
This commit is contained in:
1 parent
237b03af18
commit
b0a958f55e
6 files changed
+182
-40
No files matched your search
@@ -154,6 +154,17 @@ func (d *Detector) detectRule(fragment Fragment, rule *config.Rule) []report.Fin
|
||||
return findings
|
||||
}
|
||||
|
||||
containsKeyword := false
|
||||
for _, k := range rule.Keywords {
|
||||
if strings.Contains(fragment.Raw, k) {
|
||||
containsKeyword = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !containsKeyword && len(rule.Keywords) != 0 {
|
||||
return findings
|
||||
}
|
||||
|
||||
matchIndices := rule.Regex.FindAllStringIndex(fragment.Raw, -1)
|
||||
for _, matchIndex := range matchIndices {
|
||||
// extract secret from match
|
||||
|
||||
Reference in new issue
Block a user