stripe.go 746 B

123456789101112131415161718192021222324
  1. package rules
  2. import (
  3. "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
  4. "github.com/zricethezav/gitleaks/v8/config"
  5. )
  6. func StripeAccessToken() *config.Rule {
  7. // define rule
  8. r := config.Rule{
  9. Description: "Found a Stripe Access Token, posing a risk to payment processing services and sensitive financial data.",
  10. RuleID: "stripe-access-token",
  11. Regex: generateUniqueTokenRegex(`(sk)_(test|live)_[0-9a-z]{10,32}`, true),
  12. Keywords: []string{
  13. "sk_test",
  14. "sk_live",
  15. },
  16. }
  17. // validate
  18. tps := []string{"stripeToken := \"sk_test_" + secrets.NewSecret(alphaNumeric("30")) + "\""}
  19. fps := []string{"nonMatchingToken := \"task_test_" + secrets.NewSecret(alphaNumeric("30")) + "\""}
  20. return validate(r, tps, fps)
  21. }