4
0

flutterwave.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. "github.com/zricethezav/gitleaks/v8/regexp"
  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 := utils.GenerateSampleSecrets("flutterwavePubKey", "FLWPUBK_TEST-"+secrets.NewSecret(utils.Hex("32"))+"-X")
  19. return utils.Validate(r, tps, nil)
  20. }
  21. func FlutterwaveSecretKey() *config.Rule {
  22. // define rule
  23. r := config.Rule{
  24. RuleID: "flutterwave-secret-key",
  25. Description: "Identified a Flutterwave Secret Key, risking unauthorized financial transactions and data breaches.",
  26. Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{32}-X`),
  27. Entropy: 2,
  28. Keywords: []string{"FLWSECK_TEST"},
  29. }
  30. // validate
  31. tps := utils.GenerateSampleSecrets("flutterwavePubKey", "FLWSECK_TEST-"+secrets.NewSecret(utils.Hex("32"))+"-X")
  32. return utils.Validate(r, tps, nil)
  33. }
  34. func FlutterwaveEncKey() *config.Rule {
  35. // define rule
  36. r := config.Rule{
  37. RuleID: "flutterwave-encryption-key",
  38. Description: "Uncovered a Flutterwave Encryption Key, which may compromise payment processing and sensitive financial information.",
  39. Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{12}`),
  40. Entropy: 2,
  41. Keywords: []string{"FLWSECK_TEST"},
  42. }
  43. // validate
  44. tps := utils.GenerateSampleSecrets("flutterwavePubKey", "FLWSECK_TEST-"+secrets.NewSecret(utils.Hex("12")))
  45. return utils.Validate(r, tps, nil)
  46. }