yandex.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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: "Uncovered a Yandex AWS Access Token, potentially compromising cloud resource access and data security on Yandex Cloud.",
  11. Regex: generateSemiGenericRegex([]string{"yandex"},
  12. `YC[a-zA-Z0-9_\-]{38}`, true),
  13. Keywords: []string{
  14. "yandex",
  15. },
  16. }
  17. // validate
  18. tps := []string{
  19. generateSampleSecret("yandex",
  20. secrets.NewSecret(`YC[a-zA-Z0-9_\-]{38}`)),
  21. }
  22. return validate(r, tps, nil)
  23. }
  24. func YandexAPIKey() *config.Rule {
  25. // define rule
  26. r := config.Rule{
  27. RuleID: "yandex-api-key",
  28. Description: "Discovered a Yandex API Key, which could lead to unauthorized access to Yandex services and data manipulation.",
  29. Regex: generateSemiGenericRegex([]string{"yandex"},
  30. `AQVN[A-Za-z0-9_\-]{35,38}`, true),
  31. Keywords: []string{
  32. "yandex",
  33. },
  34. }
  35. // validate
  36. tps := []string{
  37. generateSampleSecret("yandex",
  38. secrets.NewSecret(`AQVN[A-Za-z0-9_\-]{35,38}`)),
  39. }
  40. return validate(r, tps, nil)
  41. }
  42. func YandexAccessToken() *config.Rule {
  43. // define rule
  44. r := config.Rule{
  45. RuleID: "yandex-access-token",
  46. Description: "Found a Yandex Access Token, posing a risk to Yandex service integrations and user data privacy.",
  47. Regex: generateSemiGenericRegex([]string{"yandex"},
  48. `t1\.[A-Z0-9a-z_-]+[=]{0,2}\.[A-Z0-9a-z_-]{86}[=]{0,2}`, true),
  49. Keywords: []string{
  50. "yandex",
  51. },
  52. }
  53. // validate
  54. tps := []string{
  55. generateSampleSecret("yandex",
  56. secrets.NewSecret(`t1\.[A-Z0-9a-z_-]+[=]{0,2}\.[A-Z0-9a-z_-]{86}[=]{0,2}`)),
  57. }
  58. return validate(r, tps, nil)
  59. }