From e23f7f58f39c1cb1a7415aa23c0d48d196156998 Mon Sep 17 00:00:00 2001 From: 0xn3va <47100179+0xn3va@users.noreply.github.com> Date: Wed, 13 Apr 2022 05:44:00 +0300 Subject: [PATCH] Update detect.go (#839) --- detect/detect.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/detect/detect.go b/detect/detect.go index 9ebff530..e60dc35f 100644 --- a/detect/detect.go +++ b/detect/detect.go @@ -194,7 +194,13 @@ func (d *Detector) detectRule(fragment Fragment, rule *config.Rule) []report.Fin gitleaksAllowSignature) { 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 if rule.SecretGroup != 0 { groups := rule.Regex.FindStringSubmatch(secret) @@ -206,12 +212,6 @@ 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)