npm.go 461 B

123456789101112131415161718192021222324
  1. package rules
  2. import (
  3. "github.com/zricethezav/gitleaks/v8/config"
  4. )
  5. func NPM() *config.Rule {
  6. // define rule
  7. r := config.Rule{
  8. RuleID: "npm-access-token",
  9. Description: "npm access token",
  10. Regex: generateUniqueTokenRegex(`npm_[a-z0-9]{36}`),
  11. SecretGroup: 1,
  12. Keywords: []string{
  13. "npm_",
  14. },
  15. }
  16. // validate
  17. tps := []string{
  18. generateSampleSecret("npmAccessToken", "npm_"+sampleAlphaNumeric36Token),
  19. }
  20. return validate(r, tps)
  21. }