Avoid stack trace to be anonymized in prod
MODIFY
src/utils/Constants.ts
src/utils/Constants.ts
@@ -293,6 +293,10 @@ export default class Constants {
public static readonly REGEX_VALIDATION_LONGITUDE = /^[-+]?(180(\.0+)?|((1[0-7]\d)|([1-9]?\d))(\.\d+)?)$/;
public static readonly MAX_GPS_DISTANCE_METERS = 40000000; // Earth
+ public static readonly EXCEPTION_JSON_KEYS_IN_SENSITIVE_DATA = Object.freeze([
+ 'stack'
+ ]);
+
public static readonly SENSITIVE_DATA = Object.freeze([
'firstName', 'name', 'repeatPassword', 'password', 'captcha', 'email', 'coordinates', 'latitude', 'longitude',
'Authorization', 'client_id', 'client_secret', 'refresh_token', 'localToken', 'token', 'Bearer',

MODIFY
src/utils/Logging.ts
src/utils/Logging.ts
@@ -864,7 +864,13 @@ export default class Logging {
return anonymizedMessage;
} else if (typeof message === 'object') { // If the message is an object
for (const key of Object.keys(message)) {
- if (typeof message[key] === 'string' && Constants.SENSITIVE_DATA.filter((sensitiveData) => key.toLocaleLowerCase() === sensitiveData.toLocaleLowerCase()).length > 0) {
+ // Ignore
+ if (Constants.EXCEPTION_JSON_KEYS_IN_SENSITIVE_DATA.includes(key)) {
+ continue;
+ }
+ // Check Type
+ if (typeof message[key] === 'string' &&
+ Constants.SENSITIVE_DATA.filter((sensitiveData) => key.toLocaleLowerCase() === sensitiveData.toLocaleLowerCase()).length > 0) {
// If the key indicates sensitive data and the value is a string, Anonymize the value
message[key] = Constants.ANONYMIZED_VALUE;
} else { // Otherwise, apply the anonymizeSensitiveData function

Avoid stack trace to be anonymized in prod