alibaba.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 AlibabaAccessKey() *config.Rule {
  8. // define rule
  9. r := config.Rule{
  10. RuleID: "alibaba-access-key-id",
  11. Description: "Detected an Alibaba Cloud AccessKey ID, posing a risk of unauthorized cloud resource access and potential data compromise.",
  12. Regex: utils.GenerateUniqueTokenRegex(`LTAI(?i)[a-z0-9]{20}`, false),
  13. Entropy: 2,
  14. Keywords: []string{"LTAI"},
  15. }
  16. // validate
  17. tps := []string{
  18. "alibabaKey := \"LTAI" + secrets.NewSecret(utils.Hex("20")) + "\"",
  19. }
  20. return utils.Validate(r, tps, nil)
  21. }
  22. // TODO
  23. func AlibabaSecretKey() *config.Rule {
  24. // define rule
  25. r := config.Rule{
  26. RuleID: "alibaba-secret-key",
  27. Description: "Discovered a potential Alibaba Cloud Secret Key, potentially allowing unauthorized operations and data access within Alibaba Cloud.",
  28. Regex: utils.GenerateSemiGenericRegex([]string{"alibaba"}, utils.AlphaNumeric("30"), true),
  29. Entropy: 2,
  30. Keywords: []string{"alibaba"},
  31. }
  32. // validate
  33. tps := utils.GenerateSampleSecrets("alibaba", secrets.NewSecret(utils.AlphaNumeric("30")))
  34. return utils.Validate(r, tps, nil)
  35. }