generic.go 685 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package rules
  2. import (
  3. "github.com/zricethezav/gitleaks/v8/config"
  4. )
  5. func GenericCredential() *config.Rule {
  6. // define rule
  7. r := config.Rule{
  8. RuleID: "generic-api-key",
  9. Description: "Generic API Key",
  10. Regex: generateSemiGenericRegex([]string{
  11. "key",
  12. "api[^Version]",
  13. "token",
  14. "pat",
  15. "secret",
  16. "client",
  17. "password",
  18. "auth",
  19. }, `[0-9a-z\-_.=]{10,150}`),
  20. SecretGroup: 1,
  21. Keywords: []string{
  22. "key",
  23. "api",
  24. "token",
  25. "secret",
  26. "client",
  27. "pat",
  28. "password",
  29. "auth",
  30. },
  31. Entropy: 3.7,
  32. }
  33. // validate
  34. tps := []string{
  35. generateSampleSecret("generic", "8dyfuiRyq=vVc3RRr_edRk-fK__JItpZ"),
  36. }
  37. return validate(r, tps)
  38. }