mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 12:44:22 +01:00
allow non-last-element secret groups (#792)
This commit is contained in:
1 parent
b91799aa18
commit
fbfb3f591e
1 file changed
+1
-8
+1
-8
@@ -84,7 +84,7 @@ func DetectFindings(cfg config.Config, b []byte, filePath string, commit string)
|
|||||||
// extract secret from secret group if set
|
// extract secret from secret group if set
|
||||||
if r.SecretGroup != 0 {
|
if r.SecretGroup != 0 {
|
||||||
groups := r.Regex.FindStringSubmatch(secret)
|
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
|
// Config validation should prevent this
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -108,13 +108,6 @@ func DetectFindings(cfg config.Config, b []byte, filePath string, commit string)
|
|||||||
return dedupe(findings)
|
return dedupe(findings)
|
||||||
}
|
}
|
||||||
|
|
||||||
func limit(s string) string {
|
|
||||||
if len(s) > 500 {
|
|
||||||
return s[:500] + "..."
|
|
||||||
}
|
|
||||||
return s
|
|
||||||
}
|
|
||||||
|
|
||||||
func printFinding(f report.Finding) {
|
func printFinding(f report.Finding) {
|
||||||
var b []byte
|
var b []byte
|
||||||
b, _ = json.MarshalIndent(f, "", " ")
|
b, _ = json.MarshalIndent(f, "", " ")
|
||||||
|
|||||||
Reference in new issue
Block a user