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 StripeAccessToken() *config.Rule {
@@ -24,14 +22,6 @@ func StripeAccessToken() *config.Rule {
}
// validate
tps := []string{"stripeToken := \"sk_test_" + sampleHex32Token + "\""}
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 stripe-access-token")
}
}
return &r
tps := []string{"stripeToken := \"sk_test_" + secrets.NewSecret(alphaNumeric("30")) + "\""}
return validate(r, tps)
}