shopify.go 2.1 KB

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