Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(redact): mask Perplexity API keys (pplx-)
kevin9327acad40e7c3ad
diff --git a/server/redact.test.ts b/server/redact.test.tsindex 71d2fd97c7..b7760c096b 100644--- a/server/redact.test.ts+++ b/server/redact.test.ts@@ -192,6 +192,17 @@ describe("redactSecretsInText", () => {}});+ it("masks Perplexity API keys", () => {+ // pplx- plus 48 letters and digits, assembled at runtime like the cases above.+ const key = `${"pp" + "lx-"}${"0123456789ABCDEFGHIJKLMN"}${"opqrstuvwxyzabcdefghijkl"}`;+ expect(redactSecretsInText(`perplexity ${key} search`)).toBe(`perplexity «redacted ${key.length} chars» search`);+ expect(holdsCredential(`search via ${key}`)).toBe(true);+ for (const ordinary of ["perplexity/pplx-decider-v1.1-27b", `${"pp" + "lx-"}${"a".repeat(47)}`, `${"pp" + "lx-"}${"a".repeat(49)}`, `example_${"pp" + "lx-"}${"a".repeat(48)}`]) {+ expect(redactSecretsInText(ordinary)).toBe(ordinary);+ expect(holdsCredential(ordinary)).toBe(false);+ }+ });+it.each([["xai-", 20],["gsk_", 40],diff --git a/shared/redact.ts b/shared/redact.tsindex d0fa47f644..3183f116f0 100644--- a/shared/redact.ts+++ b/shared/redact.ts@@ -32,6 +32,7 @@ const KEY_PREFIXES: RegExp[] = [/\bAIza[0-9A-Za-z_-]{30,}/g, // google api key/\bnpm_[A-Za-z0-9]{20,}/g, // npm/\bntn_[A-Za-z0-9]{46}(?![A-Za-z0-9_-])/g, // notion integration tokens+ /\bpplx-[A-Za-z0-9]{48}(?![A-Za-z0-9_-])/g, // perplexity api keys/\bwhsec_[A-Za-z0-9_-]{20,}/g, // webhook secrets, alone or in an automation's address/\bSG\.[A-Za-z0-9_-]{22}\.[A-Za-z0-9_-]{43}(?![A-Za-z0-9_-])/g, // sendgrid api keys/\bbak_[A-Za-z0-9_-]{20,}/g, // Bot API keys