plaid.go 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 := []string{
  21. utils.GenerateSampleSecret("plaid", secrets.NewSecret(utils.AlphaNumeric("24"))),
  22. }
  23. return utils.Validate(r, tps, nil)
  24. }
  25. func PlaidSecretKey() *config.Rule {
  26. // define rule
  27. r := config.Rule{
  28. RuleID: "plaid-secret-key",
  29. Description: "Detected a Plaid Secret key, risking unauthorized access to financial accounts and sensitive transaction data.",
  30. Regex: utils.GenerateSemiGenericRegex([]string{"plaid"}, utils.AlphaNumeric("30"), true),
  31. Entropy: 3.5,
  32. Keywords: []string{
  33. "plaid",
  34. },
  35. }
  36. // validate
  37. tps := []string{
  38. utils.GenerateSampleSecret("plaid", secrets.NewSecret(utils.AlphaNumeric("30"))),
  39. }
  40. return utils.Validate(r, tps, nil)
  41. }
  42. func PlaidAccessToken() *config.Rule {
  43. // define rule
  44. r := config.Rule{
  45. RuleID: "plaid-api-token",
  46. Description: "Discovered a Plaid API Token, potentially compromising financial data aggregation and banking services.",
  47. Regex: utils.GenerateSemiGenericRegex([]string{"plaid"},
  48. fmt.Sprintf("access-(?:sandbox|development|production)-%s", utils.Hex8_4_4_4_12()), true),
  49. Keywords: []string{
  50. "plaid",
  51. },
  52. }
  53. // validate
  54. tps := []string{
  55. utils.GenerateSampleSecret("plaid", secrets.NewSecret(fmt.Sprintf("access-(?:sandbox|development|production)-%s", utils.Hex8_4_4_4_12()))),
  56. }
  57. return utils.Validate(r, tps, nil)
  58. }