shopify.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package rules
  2. import (
  3. "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
  4. "regexp"
  5. "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
  6. "github.com/zricethezav/gitleaks/v8/config"
  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 := []string{"shopifySecret := \"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 := []string{"shopifyToken := \"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 := []string{"shopifyToken := \"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 := []string{"shopifyToken := \"shppa_" + secrets.NewSecret(utils.Hex("32")) + "\""}
  58. return utils.Validate(r, tps, nil)
  59. }