secret-patterns.txt 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # Secret-pattern corpus for push-gate regex layer.
  2. #
  3. # Format: one regex per non-empty, non-comment line. Lines starting with `#`
  4. # are comments. The scan-secrets.sh script feeds these to ripgrep.
  5. #
  6. # Patterns use Rust regex syntax (ripgrep's default). Anchors are NOT added
  7. # automatically — write them yourself if needed. Match is against the diff
  8. # body (added lines only; prefix `^+` is stripped before match).
  9. # === API / OAuth tokens (vendor-specific) ===
  10. sk-[A-Za-z0-9_-]{20,}
  11. sk-ant-api[0-9]+-[A-Za-z0-9_-]{20,}
  12. sk-ant-oauth-[A-Za-z0-9_-]{20,}
  13. sk-proj-[A-Za-z0-9_-]{20,}
  14. ghp_[A-Za-z0-9]{36}
  15. gh[suor]_[A-Za-z0-9]{30,}
  16. github_pat_[A-Za-z0-9_]{20,}
  17. xox[baprs]-[0-9A-Za-z-]{10,}
  18. AKIA[0-9A-Z]{16}
  19. ASIA[0-9A-Z]{16}
  20. sk_live_[0-9a-zA-Z]{24,}
  21. rk_live_[0-9a-zA-Z]{24,}
  22. AIza[0-9A-Za-z_-]{35}
  23. ya29\.[0-9A-Za-z_-]+
  24. SG\.[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{20,}
  25. (?i)dckr_pat_[A-Za-z0-9_-]{20,}
  26. npm_[A-Za-z0-9]{36}
  27. glpat-[0-9A-Za-z_-]{20}
  28. # === Cryptographic material ===
  29. -----BEGIN (RSA |EC |DSA |OPENSSH |ENCRYPTED |PGP |PGP PRIVATE KEY BLOCK)?PRIVATE KEY-----
  30. -----BEGIN CERTIFICATE-----
  31. eyJ[A-Za-z0-9_-]{10,}\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+
  32. # === DSNs with embedded credentials ===
  33. (postgres|postgresql|mysql|mongodb|mongodb\+srv|redis|rediss|amqp|amqps|clickhouse)://[^:/"' ]+:[^@/"' ]{4,}@
  34. # === Generic (high false-positive; FP-filter applies) ===
  35. (?i)(password|passwd|secret|token|api[_-]?key|apikey|private[_-]?key|access[_-]?key|client[_-]?secret|auth[_-]?token|oauth[_-]?token|bearer)\s*[=:]\s*["'][^"'\s]{12,}["']
  36. # === Env-file leakage (by content shape, not filename) ===
  37. (?i)^\s*(password|secret|token|api_key|apikey|access_key|private_key|client_secret|auth_token)\s*=\s*[^$\s<]{12,}$