shippo.go 836 B

12345678910111213141516171819202122232425
  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 ShippoAPIToken() *config.Rule {
  8. // define rule
  9. r := config.Rule{
  10. RuleID: "shippo-api-token",
  11. Description: "Discovered a Shippo API token, potentially compromising shipping services and customer order data.",
  12. Regex: utils.GenerateUniqueTokenRegex(`shippo_(?:live|test)_[a-fA-F0-9]{40}`, false),
  13. Entropy: 2,
  14. Keywords: []string{
  15. "shippo_",
  16. },
  17. }
  18. // validate
  19. tps := utils.GenerateSampleSecrets("shippo", "shippo_live_"+secrets.NewSecret(utils.Hex("40")))
  20. tps = append(tps, utils.GenerateSampleSecrets("shippo", "shippo_test_"+secrets.NewSecret(utils.Hex("40")))...)
  21. return utils.Validate(r, tps, nil)
  22. }