mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-28 20:24:22 +01:00
feat(rules): Add Perplexity AI API key detection (#1825)
* feat(rules): Add Perplexity AI API key detection * Fix generation * Fix imports * Update cmd/generate/config/rules/perplexity.go Co-authored-by: Richard Gomez <32133502+rgmz@users.noreply.github.com> * Update cmd/generate/config/rules/perplexity.go Co-authored-by: Richard Gomez <32133502+rgmz@users.noreply.github.com> * Update cmd/generate/config/rules/perplexity.go Co-authored-by: Richard Gomez <32133502+rgmz@users.noreply.github.com> * Adjust regex, add imports * Generate config --------- Co-authored-by: vno <vno@serity.io> Co-authored-by: Richard Gomez <32133502+rgmz@users.noreply.github.com>
This commit is contained in:
3 files changed
+35
No files matched your search
@@ -167,6 +167,7 @@ func main() {
|
||||
rules.OktaAccessToken(),
|
||||
rules.OpenAI(),
|
||||
rules.OpenshiftUserToken(),
|
||||
rules.PerplexityAPIKey(),
|
||||
rules.PlaidAccessID(),
|
||||
rules.PlaidSecretKey(),
|
||||
rules.PlaidAccessToken(),
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/cmd/generate/config/utils"
|
||||
|
||||
"github.com/zricethezav/gitleaks/v8/config"
|
||||
)
|
||||
|
||||
func PerplexityAPIKey() *config.Rule {
|
||||
// Define Rule
|
||||
r := config.Rule{
|
||||
RuleID: "perplexity-api-key",
|
||||
Description: "Detected a Perplexity API key, which could lead to unauthorized access to Perplexity AI services and data exposure.",
|
||||
Regex: regexp.MustCompile(`\b(pplx-[a-zA-Z0-9]{48})(?:[\x60'"\s;]|\\[nr]|$|\b)`),
|
||||
Keywords: []string{"pplx-"},
|
||||
Entropy: 4.0,
|
||||
}
|
||||
|
||||
// validate
|
||||
tps := utils.GenerateSampleSecrets("perplexity", "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'")
|
||||
fps := []string{
|
||||
"PERPLEXITY_API_KEY=pplx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
}
|
||||
return utils.Validate(r, tps, fps)
|
||||
}
|
||||
Reference in new issue
Block a user