diff --git a/packages/server/logging/expressLogging.ts b/packages/server/logging/expressLogging.ts index 3ed0ca38e5..d76c54ea1a 100644 --- a/packages/server/logging/expressLogging.ts +++ b/packages/server/logging/expressLogging.ts @@ -111,7 +111,20 @@ export const LoggingExpressMiddleware = HttpLogger({ return { statusCode: res.raw.statusCode, // Allowlist useful headers - headers: resRaw.raw.headers, + headers: Object.fromEntries( + Object.entries(resRaw.raw.headers).filter( + ([key]) => + ![ + 'set-cookie', + 'authorization', + 'cf-connecting-ip', + 'true-client-ip', + 'x-real-ip', + 'x-forwarded-for', + 'x-original-forwarded-for' + ].includes(key.toLocaleLowerCase()) + ) + ), userId: auth?.userId } })