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 PyPI API tokens (pypi-AgE…)
kevin5bce12634546
diff --git a/server/redact.test.ts b/server/redact.test.tsindex ede14c2868..aa00279f01 100644--- a/server/redact.test.ts+++ b/server/redact.test.ts@@ -150,6 +150,7 @@ describe("redactSecretsInText", () => {[`groq ${"gsk_"}${alpha}ABCD`, /gsk_/],[`meta ${"LLM|"}607358788850350|${alpha}`, /LLM\|6073/],[`huggingface ${"hf_"}${alpha}`, /hf_/],+ [`pypi ${"py" + "pi-"}AgEIcHlwaS5vcmcCJDAwMDAwMDAwLTAwMDAtMDAwMC0wMDAwLTAwMDAwMDAwMDAwMAACKlszLCJhYmNkZWYiXQAABiBy${alpha}`, /pypi-|AgEIcHlwaS5vcmc/],[`gitlab ${"glp" + "at-"}${alpha.slice(0, 20)}`, /glpat-[a-z]/],[`gitlab routable ${"glp" + "at-"}${alpha.slice(0, 27)}.01.0r03gxo7a`, /glpat-[a-z]|r03gxo7a/],[`gitlab deploy ${"gld" + "t-"}${alpha.slice(0, 20)}`, /gldt-[a-z]/],@@ -290,6 +291,7 @@ describe("redactSecretsInText", () => {describe("holdsCredential", () => {it("knows a provider key or a private key block, never a name, a placeholder or code that reads one", () => {for (const text of [+ `TWINE_PASSWORD: ${"py" + "pi-"}AgENdGVzdC5weXBpLm9yZwIkMDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAw`,'{"apiKey": "sk-ant-api03-0123456789abcdefABCD"}', "GITHUB_TOKEN=ghp_0123456789abcdefghij0123", "-----BEGIN OPENSSH PRIVATE KEY-----\nabc\n","aws_access_key_id = AKIAABCDEFGHIJKLMNOP", `git clone https://oauth2:${"glp" + "at-"}[email protected]/x.git`, `runner token ${"glr" + "tr-"}0123456789abcdefABCD`, `SLACK_APP_TOKEN: ${"xa" + "pp-"}1-A0123456789-1234567890123-abcdef0123456789`, `stripe.secret = "${"sk_" + "live_"}0123456789abcdefABCD"`,]) expect(holdsCredential(text), text).toBe(true);diff --git a/shared/redact.ts b/shared/redact.tsindex 2b90e8c0fb..70fdfc8e36 100644--- a/shared/redact.ts+++ b/shared/redact.ts@@ -22,6 +22,7 @@ const KEY_PREFIXES: RegExp[] = [/\bcsk-[A-Za-z0-9]{32,}/g, // cerebras/\bLLM\|\d{6,}\|[A-Za-z0-9_-]{16,}/g, // meta model api/\bhf_[A-Za-z0-9]{30,}/g, // hugging face+ /\bpypi-AgE[A-Za-z0-9_-]{50,}/g, // pypi and testpypi api tokens (macaroons)/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{20,}/g, // github classic/\bgithub_pat_[A-Za-z0-9_]{20,}/g, // github fine-grained/\bgl(?:pat|dt|rtr?)-[A-Za-z0-9_-]{20,}(?:\.[A-Za-z0-9_-]+)*/g, // gitlab personal, deploy and runner tokens (routable ones carry .-parts)