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:
+15
-1
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user