From d5df8e5d196e4d1060c7cd46d5efe858e63822d1 Mon Sep 17 00:00:00 2001 From: Antony Date: Wed, 24 Jan 2024 16:41:41 +0530 Subject: [PATCH 1/2] Fix: logger utility fix --- packages/contentstack-utilities/src/logger.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/contentstack-utilities/src/logger.ts b/packages/contentstack-utilities/src/logger.ts index 2120acb64f..5f810438c3 100644 --- a/packages/contentstack-utilities/src/logger.ts +++ b/packages/contentstack-utilities/src/logger.ts @@ -206,7 +206,7 @@ export default class Logger { * the sensitiveKeys array, and false otherwise. */ isSensitiveKey(keyStr: string) { - if (keyStr) { + if (keyStr && typeof keyStr !== 'symbol') { return this.sensitiveKeys.some((regex) => regex.test(keyStr)); } } @@ -235,13 +235,17 @@ export default class Logger { * redacted. */ redact(obj: any) { - const copy = klona(obj); - this.redactObject(copy); + try { + const copy = klona(obj); + this.redactObject(copy); - const splat = copy[Symbol.for('splat')]; - this.redactObject(splat); + const splat = copy[Symbol.for('splat')]; + this.redactObject(splat); - return copy; + return copy; + } catch (error) { + return obj; + } } /** From cdf2d467d3195e4270c384047b911f7f9c335040 Mon Sep 17 00:00:00 2001 From: Antony Date: Wed, 24 Jan 2024 16:44:50 +0530 Subject: [PATCH 2/2] Type check added --- packages/contentstack-utilities/src/logger.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/contentstack-utilities/src/logger.ts b/packages/contentstack-utilities/src/logger.ts index 5f810438c3..e457e22395 100644 --- a/packages/contentstack-utilities/src/logger.ts +++ b/packages/contentstack-utilities/src/logger.ts @@ -206,7 +206,7 @@ export default class Logger { * the sensitiveKeys array, and false otherwise. */ isSensitiveKey(keyStr: string) { - if (keyStr && typeof keyStr !== 'symbol') { + if (keyStr && typeof keyStr === 'string') { return this.sensitiveKeys.some((regex) => regex.test(keyStr)); } }