Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/lib/error-reporting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ const SENSITIVE_KEY_PATTERN = /(?:password|secret|token|key|auth|cred)/i;
const VERCEL_BLOB_TOKEN_PATTERN = /vercel_blob_rw_[a-zA-Z0-9_-]+/g;

function sanitizeString(data: string): string {
return data.replace(VERCEL_BLOB_TOKEN_PATTERN, "[REDACTED_VERCEL_BLOB_TOKEN]");
// Performance optimization: Fast-path check using includes() to avoid
// expensive regex execution on strings that do not contain Vercel Blob tokens.
return data.includes("vercel_blob_rw_")
? data.replace(VERCEL_BLOB_TOKEN_PATTERN, "[REDACTED_VERCEL_BLOB_TOKEN]")
: data;
}

function sanitizeError(data: Error, seen: WeakSet<object>): Error {
Expand Down