flutterwave.go 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 FlutterwavePublicKey() *config.Rule {
  9. // define rule
  10. r := config.Rule{
  11. RuleID: "flutterwave-public-key",
  12. Description: "Detected a Finicity Public Key, potentially exposing public cryptographic operations and integrations.",
  13. Regex: regexp.MustCompile(`FLWPUBK_TEST-(?i)[a-h0-9]{32}-X`),
  14. Entropy: 2,
  15. Keywords: []string{"FLWPUBK_TEST"},
  16. }
  17. // validate
  18. tps := []string{
  19. utils.GenerateSampleSecret("flutterwavePubKey", "FLWPUBK_TEST-"+secrets.NewSecret(utils.Hex("32"))+"-X"),
  20. }
  21. return utils.Validate(r, tps, nil)
  22. }
  23. func FlutterwaveSecretKey() *config.Rule {
  24. // define rule
  25. r := config.Rule{
  26. RuleID: "flutterwave-secret-key",
  27. Description: "Identified a Flutterwave Secret Key, risking unauthorized financial transactions and data breaches.",
  28. Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{32}-X`),
  29. Entropy: 2,
  30. Keywords: []string{"FLWSECK_TEST"},
  31. }
  32. // validate
  33. tps := []string{
  34. utils.GenerateSampleSecret("flutterwavePubKey", "FLWSECK_TEST-"+secrets.NewSecret(utils.Hex("32"))+"-X"),
  35. }
  36. return utils.Validate(r, tps, nil)
  37. }
  38. func FlutterwaveEncKey() *config.Rule {
  39. // define rule
  40. r := config.Rule{
  41. RuleID: "flutterwave-encryption-key",
  42. Description: "Uncovered a Flutterwave Encryption Key, which may compromise payment processing and sensitive financial information.",
  43. Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{12}`),
  44. Entropy: 2,
  45. Keywords: []string{"FLWSECK_TEST"},
  46. }
  47. // validate
  48. tps := []string{
  49. utils.GenerateSampleSecret("flutterwavePubKey", "FLWSECK_TEST-"+secrets.NewSecret(utils.Hex("12"))),
  50. }
  51. return utils.Validate(r, tps, nil)
  52. }