pypi.go 597 B

1234567891011121314151617181920212223242526
  1. package rules
  2. import (
  3. "regexp"
  4. "github.com/zricethezav/gitleaks/v8/cmd/generate/secrets"
  5. "github.com/zricethezav/gitleaks/v8/config"
  6. )
  7. func PyPiUploadToken() *config.Rule {
  8. // define rule
  9. r := config.Rule{
  10. Description: "PyPI upload token",
  11. RuleID: "pypi-upload-token",
  12. Regex: regexp.MustCompile(
  13. `pypi-AgEIcHlwaS5vcmc[A-Za-z0-9\-_]{50,1000}`),
  14. Keywords: []string{
  15. "pypi-AgEIcHlwaS5vcmc",
  16. },
  17. }
  18. // validate
  19. tps := []string{"pypiToken := \"pypi-AgEIcHlwaS5vcmc" + secrets.NewSecret(hex("32")) +
  20. secrets.NewSecret(hex("32")) + "\""}
  21. return validate(r, tps, nil)
  22. }