alibaba.go 1.2 KB

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