postman.go 752 B

1234567891011121314151617181920212223242526
  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}`, true),
  13. Keywords: []string{
  14. "PMAK-",
  15. },
  16. }
  17. // validate
  18. tps := []string{
  19. utils.GenerateSampleSecret("postmanAPItoken", "PMAK-"+secrets.NewSecret(utils.Hex("24"))+"-"+secrets.NewSecret(utils.Hex("34"))),
  20. }
  21. return utils.Validate(r, tps, nil)
  22. }