From fbfb3f591ea4004eec6f1a6ce31b0ff6a4dc879d Mon Sep 17 00:00:00 2001 From: Zachary Rice Date: Tue, 22 Feb 2022 16:34:56 -0600 Subject: [PATCH] allow non-last-element secret groups (#792) --- detect/detect.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/detect/detect.go b/detect/detect.go index aad771c1..cfdc82bd 100644 --- a/detect/detect.go +++ b/detect/detect.go @@ -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, "", " ")