mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-13 13:17:40 +02:00
[eric] drm: redact Authorization bearer token in [drm-req] license logging
(cherry picked from commit 7b32eeea602e436e102fe7578bf50eccace6e0e0)
This commit is contained in:
+7
-1
@@ -1752,7 +1752,13 @@ app.whenReady().then(async () => {
|
||||
console.log(`[drm-req] ${details.method} ${details.url}`);
|
||||
for (const [k, v] of Object.entries(details.requestHeaders || {})) {
|
||||
if (/content-type|origin|referer|auth|accept/i.test(k)) {
|
||||
console.log(`[drm-req] ${k}: ${v}`);
|
||||
// Keep the auth scheme for debugging, never the token itself.
|
||||
let safe = v;
|
||||
if (/authorization/i.test(k)) {
|
||||
const sp = String(v).indexOf(' ');
|
||||
safe = sp > 0 ? `${String(v).slice(0, sp)} <redacted>` : '<redacted>';
|
||||
}
|
||||
console.log(`[drm-req] ${k}: ${safe}`);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user