mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 05:24:22 +01:00
Update detect.go (#839)
This commit is contained in:
1 parent
606bb1a13b
commit
e23f7f58f3
1 file changed
+7
-7
+7
-7
@@ -194,7 +194,13 @@ func (d *Detector) detectRule(fragment Fragment, rule *config.Rule) []report.Fin
|
|||||||
gitleaksAllowSignature) {
|
gitleaksAllowSignature) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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
|
// extract secret from secret group if set
|
||||||
if rule.SecretGroup != 0 {
|
if rule.SecretGroup != 0 {
|
||||||
groups := rule.Regex.FindStringSubmatch(secret)
|
groups := rule.Regex.FindStringSubmatch(secret)
|
||||||
@@ -206,12 +212,6 @@ func (d *Detector) detectRule(fragment Fragment, rule *config.Rule) []report.Fin
|
|||||||
finding.Secret = secret
|
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
|
// check entropy
|
||||||
entropy := shannonEntropy(finding.Secret)
|
entropy := shannonEntropy(finding.Secret)
|
||||||
finding.Entropy = float32(entropy)
|
finding.Entropy = float32(entropy)
|
||||||
|
|||||||
Reference in new issue
Block a user