yandex.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package rules
  2. import (
  3. "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
  4. "github.com/zricethezav/gitleaks/v8/config"
  5. )
  6. func YandexAWSAccessToken() *config.Rule {
  7. // define rule
  8. r := config.Rule{
  9. RuleID: "yandex-aws-access-token",
  10. Description: "Yandex AWS Access Token",
  11. Regex: generateSemiGenericRegex([]string{"yandex"},
  12. `YC[a-zA-Z0-9_\-]{38}`),
  13. SecretGroup: 1,
  14. Keywords: []string{
  15. "yandex",
  16. },
  17. }
  18. // validate
  19. tps := []string{
  20. generateSampleSecret("yandex",
  21. secrets.NewSecret(`YC[a-zA-Z0-9_\-]{38}`)),
  22. }
  23. return validate(r, tps, nil)
  24. }
  25. func YandexAPIKey() *config.Rule {
  26. // define rule
  27. r := config.Rule{
  28. RuleID: "yandex-api-key",
  29. Description: "Yandex API Key",
  30. Regex: generateSemiGenericRegex([]string{"yandex"},
  31. `AQVN[A-Za-z0-9_\-]{35,38}`),
  32. SecretGroup: 1,
  33. Keywords: []string{
  34. "yandex",
  35. },
  36. }
  37. // validate
  38. tps := []string{
  39. generateSampleSecret("yandex",
  40. secrets.NewSecret(`AQVN[A-Za-z0-9_\-]{35,38}`)),
  41. }
  42. return validate(r, tps, nil)
  43. }
  44. func YandexAccessToken() *config.Rule {
  45. // define rule
  46. r := config.Rule{
  47. RuleID: "yandex-access-token",
  48. Description: "Yandex Access Token",
  49. Regex: generateSemiGenericRegex([]string{"yandex"},
  50. `t1\.[A-Z0-9a-z_-]+[=]{0,2}\.[A-Z0-9a-z_-]{86}[=]{0,2}`),
  51. SecretGroup: 1,
  52. Keywords: []string{
  53. "yandex",
  54. },
  55. }
  56. // validate
  57. tps := []string{
  58. generateSampleSecret("yandex",
  59. secrets.NewSecret(`t1\.[A-Z0-9a-z_-]+[=]{0,2}\.[A-Z0-9a-z_-]{86}[=]{0,2}`)),
  60. }
  61. return validate(r, tps, nil)
  62. }