Use first non-empty group if secretGroup isn't set (#1459)

* feat(detect): secret is first non-empty group

* test: fix errors

- update capture groups
- update expected data
This commit is contained in:
Richard Gomez authored and GitHub committed 2024-08-07 12:10:05 -05:00
1 parent b4009bfba4
commit d3c4b9078e
4 files changed
+30 -23

No files matched your search

+2 -2
View File
@@ -79,13 +79,13 @@ title = "gitleaks config"
[[rules]]
id = "slack"
description = "Slack"
regex = '''xox[baprs]-([0-9a-zA-Z]{10,48})?'''
regex = '''xox[baprs]-(?:[0-9a-zA-Z]{10,48})?'''
tags = ["key", "Slack"]
[[rules]]
id = "apkey"
description = "Asymmetric Private Key"
regex = '''-----BEGIN ((EC|PGP|DSA|RSA|OPENSSH) )?PRIVATE KEY( BLOCK)?-----'''
regex = '''-----BEGIN (?:(?:EC|PGP|DSA|RSA|OPENSSH) )?PRIVATE KEY(?: BLOCK)?-----'''
tags = ["key", "AsymmetricPrivateKey"]
[[rules]]