Fix server logs leak (#18423)

# Introduction

Previously the auth jwt stragegy would lod the whole user entity in the
auth user context
On an exception it would completely get logged on the pods


## Security layer
- 0/ Updating the type system ( devxp only though )
- 1/ The jwt auth stragegy only load a specific sub set of the user
entity
- 2/ Sanitizing at the exception log level directly in case of a user
context
- 3/ Sanitizing at the console driver

The last two sanitization could sound a bit redundant though they're
still good fallback to keep in case new path occurs in the cb
This commit is contained in:
Paul Rastoin
2026-03-05 14:40:23 +01:00
committed by GitHub
parent 647c32ff3e
commit 38ad0820c0
31 changed files with 147 additions and 75 deletions
@@ -11,8 +11,22 @@ export class ExceptionHandlerConsoleDriver
exceptions: ReadonlyArray<any>,
options?: ExceptionHandlerOptions,
) {
const sanitizedOptions = options
? {
...options,
user: options.user
? {
id: options.user.id,
email: options.user.email,
firstName: options.user.firstName,
lastName: options.user.lastName,
}
: undefined,
}
: undefined;
console.group('Exception Captured');
console.info(options);
console.info(sanitizedOptions);
console.error(exceptions);
console.groupEnd();