postman.go 755 B

123456789101112131415161718192021222324
  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 PostManAPI() *config.Rule {
  8. // define rule
  9. r := config.Rule{
  10. RuleID: "postman-api-token",
  11. Description: "Uncovered a Postman API token, potentially compromising API testing and development workflows.",
  12. Regex: utils.GenerateUniqueTokenRegex(`PMAK-(?i)[a-f0-9]{24}\-[a-f0-9]{34}`, false),
  13. Entropy: 3,
  14. Keywords: []string{
  15. "PMAK-",
  16. },
  17. }
  18. // validate
  19. tps := utils.GenerateSampleSecrets("postmanAPItoken", "PMAK-"+secrets.NewSecret(utils.Hex("24"))+"-"+secrets.NewSecret(utils.Hex("34")))
  20. return utils.Validate(r, tps, nil)
  21. }