Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion sdk/typescript/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function errorMessage(error: unknown): string {
export function safeErrorMessage(error: unknown): string {
const message = errorMessage(error);
const recognizableCredential =
/(?:\b(?:sk-(?:proj-)?|github_pat_|gh[pousr]_|npm_)\S+|\b(?:bearer|basic|token)(?:\s|%20|\+)+\S+|:\/\/[^\s/@]+@|-----BEGIN [A-Z ]*PRIVATE KEY(?: BLOCK)?-----)/iu.test(
/(?:\b(?:sk-(?:proj-)?|github_pat_|gh[pousr]_|npm_|lin_api_|fw_)\S+|\b(?:bearer|basic|token)(?:\s|%20|\+)+\S+|:\/\/[^\s/@]+@|-----BEGIN [A-Z ]*PRIVATE KEY(?: BLOCK)?-----)/iu.test(
message,
);
const assignments = message.matchAll(
Expand Down
2 changes: 2 additions & 0 deletions sdk/typescript/tests-ts/errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ describe("error messages", () => {
for (const message of [
"request failed: token=SYNTHETIC_TOKEN",
"Authorization: Bearer sk-proj-SYNTHETIC_KEY_123",
"Linear failed for lin_api_SYNTHETIC_SECRET",
"Fireworks failed for fw_SYNTHETIC_SECRET",
'upstream failed: {"clientSecret":"correct horse battery staple"}',
JSON.stringify(JSON.stringify({ clientSecret: "SYNTHETIC_SECRET" })),
"authorizationHeaderValue=SYNTHETIC_SECRET",
Expand Down