easypost.go 920 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package rules
  2. import (
  3. "regexp"
  4. "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
  5. "github.com/zricethezav/gitleaks/v8/config"
  6. )
  7. func EasyPost() *config.Rule {
  8. // define rule
  9. r := config.Rule{
  10. Description: "EasyPost API token",
  11. RuleID: "easypost-api-token",
  12. Regex: regexp.MustCompile(`EZAK(?i)[a-z0-9]{54}`),
  13. Keywords: []string{"EZAK"},
  14. }
  15. // validate
  16. tps := []string{
  17. generateSampleSecret("EZAK", "EZAK"+secrets.NewSecret(alphaNumeric("54"))),
  18. }
  19. return validate(r, tps, nil)
  20. }
  21. func EasyPostTestAPI() *config.Rule {
  22. // define rule
  23. r := config.Rule{
  24. Description: "EasyPost test API token",
  25. RuleID: "easypost-test-api-token",
  26. Regex: regexp.MustCompile(`EZTK(?i)[a-z0-9]{54}`),
  27. Keywords: []string{"EZTK"},
  28. }
  29. // validate
  30. tps := []string{
  31. generateSampleSecret("EZTK", "EZTK"+secrets.NewSecret(alphaNumeric("54"))),
  32. }
  33. return validate(r, tps, nil)
  34. }