From 78bf6daf6c6f2546b57cdb579f3f9cbdf2c4cd77 Mon Sep 17 00:00:00 2001 From: Otstar Lin Date: Sat, 19 Oct 2024 14:03:37 +0800 Subject: [PATCH] fix(route/twitter): Mask the error output to avoid leak token (#17193) --- lib/routes/twitter/api/web-api/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/routes/twitter/api/web-api/utils.ts b/lib/routes/twitter/api/web-api/utils.ts index b9331440e..d01965943 100644 --- a/lib/routes/twitter/api/web-api/utils.ts +++ b/lib/routes/twitter/api/web-api/utils.ts @@ -116,7 +116,7 @@ export const twitterGot = async ( agent, }; } else if (auth) { - throw new ConfigNotFoundError(`Twitter cookie for token ${auth?.token} is not valid`); + throw new ConfigNotFoundError(`Twitter cookie for token ${auth?.token?.replace(/(\w{8})(\w+)/, (_, v1, v2) => v1 + '*'.repeat(v2.length))} is not valid`); } const jsonCookie = dispatchers ? Object.fromEntries(