Stop words (#808)

* use regex for stopwords

* fix up regex

* rm stopwords
This commit is contained in:
Zachary Rice authored and GitHub committed 2022-03-19 09:31:38 -05:00
1 parent 6e72472b60
commit 57f9bc83d1
5 files changed
+60 -7

No files matched your search

+6 -6
View File
@@ -170,12 +170,6 @@ func (d *Detector) detectRule(fragment Fragment, rule *config.Rule) []report.Fin
Tags: rule.Tags,
}
// check if the secret is in the allowlist
if rule.Allowlist.RegexAllowed(finding.Secret) ||
d.Config.Allowlist.RegexAllowed(finding.Secret) {
continue
}
// extract secret from secret group if set
if rule.SecretGroup != 0 {
groups := rule.Regex.FindStringSubmatch(secret)
@@ -187,6 +181,12 @@ func (d *Detector) detectRule(fragment Fragment, rule *config.Rule) []report.Fin
finding.Secret = secret
}
// check if the secret is in the allowlist
if rule.Allowlist.RegexAllowed(finding.Secret) ||
d.Config.Allowlist.RegexAllowed(finding.Secret) {
continue
}
// check entropy
entropy := shannonEntropy(finding.Secret)
finding.Entropy = float32(entropy)