Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Merge remote-tracking branch 'up/main' into aws

kevin9327871d1b10e09d
diff --cc server/redact.test.ts
index 7297f5a47e,ede14c2868..bb1cb08853
--- a/server/redact.test.ts
+++ b/server/redact.test.ts
@@@ -142,8 -142,8 +142,9 @@@ describe("redactSecretsInText", () =>
[`gh token ${"gh" + "p_"}${alpha}`, /ghp_/],
[`fine-grained ${"github_" + "pat_"}11ABCDEFG0${alpha}`, /github_pat_/],
[`slack ${"xox" + "b-"}${"123456789012"}-${"1234567890123"}-${alpha.slice(0, 24)}`, /xoxb-/],
+ [`slack app ${"xa" + "pp-"}1-A0123456789-${"1234567890123"}-${alpha.slice(0, 24)}`, /xapp-|A0123456789/],
[`aws ${"AKIA" + "IOSFODNN7EXAMPLE"} and more`, /IOSFODNN7EXAMPLE/],
+ [`aws temporary ${"ASIA" + "IOSFODNN7EXAMPLE"} and more`, /IOSFODNN7EXAMPLE/],
[`google ${"AIza" + "SyA-"}${alpha.slice(0, 32)}`, /AIza/],
[`npm ${"npm" + "_"}${alpha}`, /npm_[a-z]/],
[`xai ${"xai-"}${alpha}`, /xai-/],
@@@ -291,7 -291,7 +292,7 @@@ 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 [
'{"apiKey": "sk-ant-api03-0123456789abcdefABCD"}', "GITHUB_TOKEN=ghp_0123456789abcdefghij0123", "-----BEGIN OPENSSH PRIVATE KEY-----\nabc\n",
- "aws_access_key_id = AKIAABCDEFGHIJKLMNOP", `temporary aws key ${"ASIA" + "ABCDEFGHIJKLMNOP"}`, `git clone https://oauth2:${"glp" + "at-"}[email protected]/x.git`, `runner token ${"glr" + "tr-"}0123456789abcdefABCD`, `stripe.secret = "${"sk_" + "live_"}0123456789abcdefABCD"`,
- "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"`,
++ "aws_access_key_id = AKIAABCDEFGHIJKLMNOP", `temporary aws key ${"ASIA" + "ABCDEFGHIJKLMNOP"}`, `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);
for (const text of [
"token = os.environ['GITHUB_TOKEN']", "API_KEY=your-key-here", "Authorization: Bearer YOUR_TOKEN_HERE", "Keep credentials out of the repo.",
diff --cc shared/redact.ts
index d07e415d15,2b90e8c0fb..45f002f34c
--- a/shared/redact.ts
+++ b/shared/redact.ts
@@@ -26,7 -26,8 +26,8 @@@ const KEY_PREFIXES: RegExp[] =
/\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)
/\bxox[abposr]-[A-Za-z0-9-]{20,}/g, // slack
+ /\bxapp-\d-[A-Za-z0-9-]{20,}/g, // slack app-level (socket mode) tokens
- /\bAKIA[0-9A-Z]{16}\b/g, // aws access key id
+ /\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g, // aws access key id, long-term (AKIA) or temporary STS (ASIA)
/\bAIza[0-9A-Za-z_-]{30,}/g, // google api key
/\bnpm_[A-Za-z0-9]{20,}/g, // npm
/\bwhsec_[A-Za-z0-9_-]{20,}/g, // webhook secrets, alone or in an automation's address