lob.go 1.2 KB

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