perplexity.go 799 B

123456789101112131415161718192021222324252627
  1. package rules
  2. import (
  3. "regexp"
  4. "github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
  5. "github.com/zricethezav/gitleaks/v8/config"
  6. )
  7. func PerplexityAPIKey() *config.Rule {
  8. // Define Rule
  9. r := config.Rule{
  10. RuleID: "perplexity-api-key",
  11. Description: "Detected a Perplexity API key, which could lead to unauthorized access to Perplexity AI services and data exposure.",
  12. Regex: regexp.MustCompile(`\b(pplx-[a-zA-Z0-9]{48})(?:[\x60'"\s;]|\\[nr]|$|\b)`),
  13. Keywords: []string{"pplx-"},
  14. Entropy: 4.0,
  15. }
  16. // validate
  17. tps := utils.GenerateSampleSecrets("perplexity", "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'")
  18. fps := []string{
  19. "PERPLEXITY_API_KEY=pplx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  20. }
  21. return utils.Validate(r, tps, fps)
  22. }