plaid.go 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package rules
  2. import (
  3. "fmt"
  4. "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
  5. "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
  6. "github.com/zricethezav/gitleaks/v8/config"
  7. )
  8. func PlaidAccessID() *config.Rule {
  9. // define rule
  10. r := config.Rule{
  11. RuleID: "plaid-client-id",
  12. Description: "Uncovered a Plaid Client ID, which could lead to unauthorized financial service integrations and data breaches.",
  13. Regex: utils.GenerateSemiGenericRegex([]string{"plaid"}, utils.AlphaNumeric("24"), true),
  14. Entropy: 3.5,
  15. Keywords: []string{
  16. "plaid",
  17. },
  18. }
  19. // validate
  20. tps := utils.GenerateSampleSecrets("plaid", secrets.NewSecret(`[a-zA-Z0-9]{24}`))
  21. return utils.Validate(r, tps, nil)
  22. }
  23. func PlaidSecretKey() *config.Rule {
  24. // define rule
  25. r := config.Rule{
  26. RuleID: "plaid-secret-key",
  27. Description: "Detected a Plaid Secret key, risking unauthorized access to financial accounts and sensitive transaction data.",
  28. Regex: utils.GenerateSemiGenericRegex([]string{"plaid"}, utils.AlphaNumeric("30"), true),
  29. Entropy: 3.5,
  30. Keywords: []string{
  31. "plaid",
  32. },
  33. }
  34. // validate
  35. tps := utils.GenerateSampleSecrets("plaid", secrets.NewSecret(utils.AlphaNumeric("30")))
  36. return utils.Validate(r, tps, nil)
  37. }
  38. func PlaidAccessToken() *config.Rule {
  39. // define rule
  40. r := config.Rule{
  41. RuleID: "plaid-api-token",
  42. Description: "Discovered a Plaid API Token, potentially compromising financial data aggregation and banking services.",
  43. Regex: utils.GenerateSemiGenericRegex([]string{"plaid"},
  44. fmt.Sprintf("access-(?:sandbox|development|production)-%s", utils.Hex8_4_4_4_12()), true),
  45. Keywords: []string{
  46. "plaid",
  47. },
  48. }
  49. // validate
  50. tps := utils.GenerateSampleSecrets("plaid", secrets.NewSecret(fmt.Sprintf("access-(?:sandbox|development|production)-%s", utils.Hex8_4_4_4_12())))
  51. return utils.Validate(r, tps, nil)
  52. }