mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 13:14:22 +01:00
more bug
This commit is contained in:
1 parent
165df09348
commit
6fed917106
1 file changed
+3
-3
+3
-3
@@ -131,7 +131,7 @@ func (d *Detector) detectRule(fragment Fragment, rule *config.Rule) []report.Fin
|
|||||||
matchIndices := rule.Regex.FindAllStringIndex(fragment.Raw, -1)
|
matchIndices := rule.Regex.FindAllStringIndex(fragment.Raw, -1)
|
||||||
for _, matchIndex := range matchIndices {
|
for _, matchIndex := range matchIndices {
|
||||||
// extract secret from match
|
// extract secret from match
|
||||||
secret := strings.Trim(fragment.Raw[matchIndex[0]:matchIndex[1]], " \n")
|
secret := strings.Trim(fragment.Raw[matchIndex[0]:matchIndex[1]], "\n")
|
||||||
|
|
||||||
// determine location of match. Note that the location
|
// determine location of match. Note that the location
|
||||||
// in the finding will be the line/column numbers of the _match_
|
// in the finding will be the line/column numbers of the _match_
|
||||||
@@ -163,7 +163,7 @@ func (d *Detector) detectRule(fragment Fragment, rule *config.Rule) []report.Fin
|
|||||||
groups := rule.Regex.FindStringSubmatch(secret)
|
groups := rule.Regex.FindStringSubmatch(secret)
|
||||||
if len(groups) <= rule.SecretGroup || len(groups) == 0 {
|
if len(groups) <= rule.SecretGroup || len(groups) == 0 {
|
||||||
// Config validation should prevent this
|
// Config validation should prevent this
|
||||||
break
|
continue
|
||||||
}
|
}
|
||||||
secret = groups[rule.SecretGroup]
|
secret = groups[rule.SecretGroup]
|
||||||
finding.Secret = secret
|
finding.Secret = secret
|
||||||
@@ -174,7 +174,7 @@ func (d *Detector) detectRule(fragment Fragment, rule *config.Rule) []report.Fin
|
|||||||
finding.Entropy = float32(entropy)
|
finding.Entropy = float32(entropy)
|
||||||
if rule.EntropySet() && entropy <= rule.Entropy {
|
if rule.EntropySet() && entropy <= rule.Entropy {
|
||||||
// entropy is too low, skip this finding
|
// entropy is too low, skip this finding
|
||||||
return findings
|
continue
|
||||||
}
|
}
|
||||||
findings = append(findings, finding)
|
findings = append(findings, finding)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user