Generate tps (#845)

* WIP

* simplify tp generation
This commit is contained in:
Zachary Rice authored and GitHub committed 2022-04-18 21:59:38 -05:00
1 parent d8cd93cabe
commit 3474c58c9e
58 files changed
+264 -337

No files matched your search

+3 -13
View File
@@ -3,10 +3,8 @@ package rules
import (
"regexp"
"github.com/rs/zerolog/log"
"github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
"github.com/zricethezav/gitleaks/v8/config"
"github.com/zricethezav/gitleaks/v8/detect"
)
func Twilio() *config.Rule {
@@ -20,15 +18,7 @@ func Twilio() *config.Rule {
// validate
tps := []string{
"twilioAPIKey := \"SK" + sampleHex32Token + "\"",
"twilioAPIKey := \"SK" + secrets.NewSecret(hex("32")) + "\"",
}
d := detect.NewDetector(config.Config{
Rules: []*config.Rule{&r},
})
for _, tp := range tps {
if len(d.DetectString(tp)) != 1 {
log.Fatal().Msg("Failed to validate twilio")
}
}
return &r
return validate(r, tps)
}