flutterwave.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package rules
  2. import (
  3. "regexp"
  4. "github.com/zricethezav/gitleaks/v8/config"
  5. )
  6. func FlutterwavePublicKey() *config.Rule {
  7. // define rule
  8. r := config.Rule{
  9. Description: "Finicity Public Key",
  10. RuleID: "flutterwave-public-key",
  11. Regex: regexp.MustCompile(`FLWPUBK_TEST-(?i)[a-h0-9]{32}-X`),
  12. Keywords: []string{"FLWPUBK_TEST"},
  13. }
  14. // validate
  15. tps := []string{
  16. generateSampleSecret("flutterwavePubKey", "FLWPUBK_TEST-"+sampleHex32Token+"-X"),
  17. }
  18. return validate(r, tps)
  19. }
  20. func FlutterwaveSecretKey() *config.Rule {
  21. // define rule
  22. r := config.Rule{
  23. Description: "Finicity Secret Key",
  24. RuleID: "flutterwave-public-key",
  25. Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{32}-X`),
  26. Keywords: []string{"FLWSECK_TEST"},
  27. }
  28. // validate
  29. tps := []string{
  30. generateSampleSecret("flutterwavePubKey", "FLWSECK_TEST-"+sampleHex32Token+"-X"),
  31. }
  32. return validate(r, tps)
  33. }
  34. func FlutterwaveEncKey() *config.Rule {
  35. // define rule
  36. r := config.Rule{
  37. Description: "Finicity Secret Key",
  38. RuleID: "flutterwave-public-key",
  39. Regex: regexp.MustCompile(`FLWSECK_TEST-(?i)[a-h0-9]{12}`),
  40. Keywords: []string{"FLWSECK_TEST"},
  41. }
  42. // validate
  43. tps := []string{
  44. generateSampleSecret("flutterwavePubKey", "FLWSECK_TEST-"+sampleHex12Token),
  45. }
  46. return validate(r, tps)
  47. }