Files
gitleaks/cmd/generate/config/rules/privatekey.go
T
Zachary Rice 3474c58c9e Generate tps (#845)
* WIP

* simplify tp generation
2022-04-18 21:59:38 -05:00

24 lines
505 B
Go

package rules
import (
"regexp"
"github.com/zricethezav/gitleaks/v8/config"
)
func PrivateKey() *config.Rule {
// define rule
r := config.Rule{
Description: "Private Key",
RuleID: "private-key",
Regex: regexp.MustCompile(`(?i)-----BEGIN[ A-Z0-9_-]{0,100}PRIVATE KEY-----[\s\S-]*KEY----`),
Keywords: []string{"-----BEGIN PRIVATE"},
}
// validate
tps := []string{`-----BEGIN PRIVATE KEY-----
anything
-----END PRIVATE KEY-----`} // gitleaks:allow
return validate(r, tps)
}