Skip to content

Commit

Permalink
allow non-last-element secret groups (#792)
Browse files Browse the repository at this point in the history
  • Loading branch information
zricethezav committed Feb 22, 2022
1 parent b91799a commit fbfb3f5
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions detect/detect.go
Expand Up @@ -84,7 +84,7 @@ func DetectFindings(cfg config.Config, b []byte, filePath string, commit string)
// extract secret from secret group if set
if r.SecretGroup != 0 {
groups := r.Regex.FindStringSubmatch(secret)
if len(groups)-1 > r.SecretGroup || len(groups) == 0 {
if len(groups) <= r.SecretGroup || len(groups) == 0 {
// Config validation should prevent this
break
}
Expand All @@ -108,13 +108,6 @@ func DetectFindings(cfg config.Config, b []byte, filePath string, commit string)
return dedupe(findings)
}

func limit(s string) string {
if len(s) > 500 {
return s[:500] + "..."
}
return s
}

func printFinding(f report.Finding) {
var b []byte
b, _ = json.MarshalIndent(f, "", " ")
Expand Down

0 comments on commit fbfb3f5

Please sign in to comment.