Removing private keyword from private key rule (#858)

This commit is contained in:
Zachary Rice authored and GitHub committed 2022-04-27 07:29:09 -05:00
1 parent a62cc52aba
commit 9dc80b21e6
2 files changed
+8 -3

No files matched your search

+7 -2
View File
@@ -12,12 +12,17 @@ func PrivateKey() *config.Rule {
Description: "Private Key", Description: "Private Key",
RuleID: "private-key", RuleID: "private-key",
Regex: regexp.MustCompile(`(?i)-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY-----[\s\S-]*KEY----`), Regex: regexp.MustCompile(`(?i)-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY-----[\s\S-]*KEY----`),
Keywords: []string{"-----BEGIN PRIVATE"}, Keywords: []string{"-----BEGIN"},
} }
// validate // validate
tps := []string{`-----BEGIN PRIVATE KEY----- tps := []string{`-----BEGIN PRIVATE KEY-----
anything anything
-----END PRIVATE KEY-----`} // gitleaks:allow -----END PRIVATE KEY-----`,
`-----BEGIN RSA PRIVATE KEY-----
abcdefghijklmnopqrstuvwxyz
-----END RSA PRIVATE KEY-----
`,
} // gitleaks:allow
return validate(r, tps, nil) return validate(r, tps, nil)
} }
+1 -1
View File
@@ -574,7 +574,7 @@ description = "Private Key"
id = "private-key" id = "private-key"
regex = '''(?i)-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY-----[\s\S-]*KEY----''' regex = '''(?i)-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY-----[\s\S-]*KEY----'''
keywords = [ keywords = [
"-----begin private", "-----begin",
] ]
[[rules]] [[rules]]