prefect.go 703 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 Prefect() *config.Rule {
  8. // define rule
  9. r := config.Rule{
  10. RuleID: "prefect-api-token",
  11. Description: "Detected a Prefect API token, risking unauthorized access to workflow management and automation services.",
  12. Regex: utils.GenerateUniqueTokenRegex(`pnu_[a-z0-9]{36}`, true),
  13. Keywords: []string{
  14. "pnu_",
  15. },
  16. }
  17. // validate
  18. tps := []string{
  19. utils.GenerateSampleSecret("api-token", "pnu_"+secrets.NewSecret(utils.AlphaNumeric("36"))),
  20. }
  21. return utils.Validate(r, tps, nil)
  22. }