Skip to content

Commit

Permalink
Update detect.go (#839)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xn3va committed Apr 13, 2022
1 parent 606bb1a commit e23f7f5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions detect/detect.go
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit e23f7f5

Please sign in to comment.