allow non-last-element secret groups (#792)

This commit is contained in:
Zachary Rice authored and GitHub committed 2022-02-22 16:34:56 -06:00
1 parent b91799aa18
commit fbfb3f591e
1 file changed
+1 -8
+1 -8
View File
@@ -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
}
@@ -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, "", " ")