flutterwave.go 1.8 KB

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