yandex.go 1.8 KB

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