scalingo.go 849 B

12345678910111213141516171819202122232425
  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 ScalingoAPIToken() *config.Rule {
  8. // define rule
  9. r := config.Rule{
  10. Description: "Found a Scalingo API token, posing a risk to cloud platform services and application deployment security.",
  11. RuleID: "scalingo-api-token",
  12. Regex: utils.GenerateUniqueTokenRegex(`tk-us-[\w-]{48}`, false),
  13. Entropy: 2,
  14. Keywords: []string{"tk-us-"},
  15. }
  16. // validate
  17. tps := utils.GenerateSampleSecrets("scalingo", "tk-us-"+secrets.NewSecret(utils.AlphaNumericExtendedShort("48")))
  18. tps = append(tps,
  19. `scalingo_api_token = "tk-us-loys7ib9yrxcys_ta2sq85mjar6lgcsspkd9x61s7h5epf_-"`, // gitleaks:allow
  20. )
  21. return utils.Validate(r, tps, nil)
  22. }