feat(redact): block Google OAuth client secrets and Telegram bot tokens at HIGH

GOCSPX-prefixed client secrets and <bot_id>:<35-char> Telegram tokens are
never-publishable credential shapes with unambiguous formats — both now
block at HIGH like the other live-format credentials.

Contributed by @francis-eye (PR #2357).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-08-14 20:20:49 -07:00
co-authored by Claude Fable 5
parent d410142c2f
commit 69cc39c625
2 changed files with 37 additions and 0 deletions
+19
View File
@@ -374,6 +374,25 @@ export const PATTERNS: RedactPattern[] = [
nearRegex: /\bAC[a-f0-9]{32}\b/,
nearWindow: 200,
},
{
id: "google.oauth_client_secret",
tier: "HIGH",
category: "secret",
// Distinct from google.api_key (MEDIUM): an AIza key is often a public
// client key, but a GOCSPX- client secret is never publishable — leaking
// it lets anyone impersonate the OAuth app's token exchange.
description: "Google OAuth client secret (GOCSPX-…)",
regex: /\b(GOCSPX-[A-Za-z0-9_-]{20,40})(?![A-Za-z0-9_-])/,
validate: (span) => !isPlaceholderSpan(span),
},
{
id: "telegram.bot_token",
tier: "HIGH",
category: "secret",
description: "Telegram bot token (<bot-id>:AA…)",
regex: /\b([0-9]{6,16}:A[A-Za-z0-9_-]{34})(?![A-Za-z0-9_-])/,
validate: (span) => !isPlaceholderSpan(span),
},
{
id: "pem.private_key",
tier: "HIGH",