clickhouse.go 1.1 KB

123456789101112131415161718192021222324252627282930
  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. "github.com/zricethezav/gitleaks/v8/regexp"
  7. )
  8. func ClickHouseCloud() *config.Rule {
  9. // define rule
  10. r := config.Rule{
  11. RuleID: "clickhouse-cloud-api-secret-key",
  12. Description: "Identified a pattern that may indicate clickhouse cloud API secret key, risking unauthorized clickhouse cloud api access and data breaches on ClickHouse Cloud platforms.",
  13. Regex: regexp.MustCompile(`\b(4b1d[A-Za-z0-9]{38})\b`),
  14. Entropy: 3,
  15. Keywords: []string{
  16. "4b1d", // Prefix
  17. },
  18. }
  19. // validate
  20. tps := utils.GenerateSampleSecrets("ClickHouse", "4b1dbRdW3rOcB7xLthrM4BTBGK1qPLkHigpN1bXD6z")
  21. tps = append(tps, utils.GenerateSampleSecrets("ClickHouse", "4b1d"+secrets.NewSecret("[A-Za-z0-9]{38}"))...)
  22. fps := []string{
  23. `key = 4b1dXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`, // Low entropy
  24. `key = adf4b1dbRdW3rOcB7xLthrM4BTBGK1qPLkHigpN1bXD6z`, // Not start of a word
  25. }
  26. return utils.Validate(r, tps, fps)
  27. }