nytimes.go 807 B

12345678910111213141516171819202122232425262728
  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 NytimesAccessToken() *config.Rule {
  8. // define rule
  9. r := config.Rule{
  10. RuleID: "nytimes-access-token",
  11. Description: "Detected a Nytimes Access Token, risking unauthorized access to New York Times APIs and content services.",
  12. Regex: utils.GenerateSemiGenericRegex([]string{
  13. "nytimes", "new-york-times,", "newyorktimes"},
  14. utils.AlphaNumericExtended("32"), true),
  15. Keywords: []string{
  16. "nytimes",
  17. "new-york-times",
  18. "newyorktimes",
  19. },
  20. }
  21. // validate
  22. tps := utils.GenerateSampleSecrets("nytimes", secrets.NewSecret(utils.AlphaNumeric("32")))
  23. return utils.Validate(r, tps, nil)
  24. }