Make private key check less greedy and include fifth dash (#1440)

* Make private key check less greedy and include fifth dash

* Remove trailing space
This commit is contained in:
bplaxco authored and GitHub committed 2024-10-03 09:50:15 -05:00
1 parent 9c354f51c3
commit ce2702a488
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -12,7 +12,7 @@ func PrivateKey() *config.Rule {
r := config.Rule{
Description: "Identified a Private Key, which may compromise cryptographic security and sensitive data encryption.",
RuleID: "private-key",
Regex: regexp.MustCompile(`(?i)-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[\s\S-]*KEY(?: BLOCK)?----`),
Regex: regexp.MustCompile(`(?i)-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[\s\S-]*?KEY(?: BLOCK)?-----`),
Keywords: []string{"-----BEGIN"},
}
+1 -1
View File
@@ -2544,7 +2544,7 @@ keywords = [
[[rules]]
id = "private-key"
description = "Identified a Private Key, which may compromise cryptographic security and sensitive data encryption."
regex = '''(?i)-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[\s\S-]*KEY(?: BLOCK)?----'''
regex = '''(?i)-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY(?: BLOCK)?-----[\s\S-]*?KEY(?: BLOCK)?-----'''
keywords = [
"-----begin",
]