Просмотр исходного кода

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

Zachary Rice 4 лет назад
Родитель
Сommit
fbfb3f591e
1 измененных файлов с 1 добавлено и 8 удалено
  1. 1 8
      detect/detect.go

+ 1 - 8
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, "", "	")