clojars.go 719 B

12345678910111213141516171819202122232425
  1. package rules
  2. import (
  3. "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
  4. "regexp"
  5. "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
  6. "github.com/zricethezav/gitleaks/v8/config"
  7. )
  8. func Clojars() *config.Rule {
  9. // define rule
  10. r := config.Rule{
  11. Description: "Uncovered a possible Clojars API token, risking unauthorized access to Clojure libraries and potential code manipulation.",
  12. RuleID: "clojars-api-token",
  13. Regex: regexp.MustCompile(`(?i)CLOJARS_[a-z0-9]{60}`),
  14. Keywords: []string{"clojars"},
  15. }
  16. // validate
  17. tps := []string{
  18. utils.GenerateSampleSecret("clojars", "CLOJARS_"+secrets.NewSecret(utils.AlphaNumeric("60"))),
  19. }
  20. return utils.Validate(r, tps, nil)
  21. }