4
0

shopify.go 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. "github.com/zricethezav/gitleaks/v8/regexp"
  7. )
  8. func ShopifySharedSecret() *config.Rule {
  9. // define rule
  10. r := config.Rule{
  11. RuleID: "shopify-shared-secret",
  12. Description: "Found a Shopify shared secret, posing a risk to application authentication and e-commerce platform security.",
  13. Regex: regexp.MustCompile(`shpss_[a-fA-F0-9]{32}`),
  14. Entropy: 2,
  15. Keywords: []string{"shpss_"},
  16. }
  17. // validate
  18. tps := utils.GenerateSampleSecrets("shopify", "shpss_"+secrets.NewSecret(utils.Hex("32")))
  19. return utils.Validate(r, tps, nil)
  20. }
  21. func ShopifyAccessToken() *config.Rule {
  22. // define rule
  23. r := config.Rule{
  24. RuleID: "shopify-access-token",
  25. Description: "Uncovered a Shopify access token, which could lead to unauthorized e-commerce platform access and data breaches.",
  26. Regex: regexp.MustCompile(`shpat_[a-fA-F0-9]{32}`),
  27. Entropy: 2,
  28. Keywords: []string{"shpat_"},
  29. }
  30. // validate
  31. tps := utils.GenerateSampleSecrets("shopify", "shpat_"+secrets.NewSecret(utils.Hex("32")))
  32. return utils.Validate(r, tps, nil)
  33. }
  34. func ShopifyCustomAccessToken() *config.Rule {
  35. // define rule
  36. r := config.Rule{
  37. RuleID: "shopify-custom-access-token",
  38. Description: "Detected a Shopify custom access token, potentially compromising custom app integrations and e-commerce data security.",
  39. Regex: regexp.MustCompile(`shpca_[a-fA-F0-9]{32}`),
  40. Entropy: 2,
  41. Keywords: []string{"shpca_"},
  42. }
  43. // validate
  44. tps := utils.GenerateSampleSecrets("shopify", "shpca_"+secrets.NewSecret(utils.Hex("32")))
  45. return utils.Validate(r, tps, nil)
  46. }
  47. func ShopifyPrivateAppAccessToken() *config.Rule {
  48. // define rule
  49. r := config.Rule{
  50. RuleID: "shopify-private-app-access-token",
  51. Description: "Identified a Shopify private app access token, risking unauthorized access to private app data and store operations.",
  52. Regex: regexp.MustCompile(`shppa_[a-fA-F0-9]{32}`),
  53. Entropy: 2,
  54. Keywords: []string{"shppa_"},
  55. }
  56. // validate
  57. tps := utils.GenerateSampleSecrets("shopify", "shppa_"+secrets.NewSecret(utils.Hex("32")))
  58. return utils.Validate(r, tps, nil)
  59. }