infracost.go 977 B

1234567891011121314151617181920212223242526272829303132
  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 InfracostAPIToken() *config.Rule {
  8. // define rule
  9. r := config.Rule{
  10. // Human readable description of the rule
  11. Description: "Detected an Infracost API Token, risking unauthorized access to cloud cost estimation tools and financial data.",
  12. // Unique ID for the rule
  13. RuleID: "infracost-api-token",
  14. // Regex capture group for the actual secret
  15. // Regex used for detecting secrets. See regex section below for more details
  16. Regex: utils.GenerateUniqueTokenRegex(`ico-[a-zA-Z0-9]{32}`, true),
  17. // Keywords used for string matching on fragments (think of this as a prefilter)
  18. Keywords: []string{"ico-"},
  19. }
  20. // validate
  21. tps := []string{
  22. utils.GenerateSampleSecret("ico", "ico-"+secrets.NewSecret("[A-Za-z0-9]{32}")),
  23. }
  24. return utils.Validate(r, tps, nil)
  25. }