lob.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package rules
  2. import (
  3. "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
  4. "github.com/zricethezav/gitleaks/v8/config"
  5. )
  6. func LobPubAPIToken() *config.Rule {
  7. // define rule
  8. r := config.Rule{
  9. Description: "Detected a Lob Publishable API Key, posing a risk of exposing mail and print service integrations.",
  10. RuleID: "lob-pub-api-key",
  11. Regex: generateSemiGenericRegex([]string{"lob"}, `(test|live)_pub_[a-f0-9]{31}`, true),
  12. Keywords: []string{
  13. "test_pub",
  14. "live_pub",
  15. "_pub",
  16. },
  17. }
  18. // validate
  19. tps := []string{
  20. generateSampleSecret("lob", "test_pub_"+secrets.NewSecret(hex("31"))),
  21. }
  22. return validate(r, tps, nil)
  23. }
  24. func LobAPIToken() *config.Rule {
  25. // define rule
  26. r := config.Rule{
  27. Description: "Uncovered a Lob API Key, which could lead to unauthorized access to mailing and address verification services.",
  28. RuleID: "lob-api-key",
  29. Regex: generateSemiGenericRegex([]string{"lob"}, `(live|test)_[a-f0-9]{35}`, true),
  30. Keywords: []string{
  31. "test_",
  32. "live_",
  33. },
  34. }
  35. // validate
  36. tps := []string{
  37. generateSampleSecret("lob", "test_"+secrets.NewSecret(hex("35"))),
  38. }
  39. return validate(r, tps, nil)
  40. }