plaid.go 1.8 KB

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