shippo.go 807 B

123456789101112131415161718192021222324252627
  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-f0-9]{40}`, true),
  13. Keywords: []string{
  14. "shippo_",
  15. },
  16. }
  17. // validate
  18. tps := []string{
  19. utils.GenerateSampleSecret("shippo", "shippo_live_"+secrets.NewSecret(utils.Hex("40"))),
  20. utils.GenerateSampleSecret("shippo", "shippo_test_"+secrets.NewSecret(utils.Hex("40"))),
  21. }
  22. return utils.Validate(r, tps, nil)
  23. }