From f39d0507641bee75cd78ad8b3bb41f0cd5a009a2 Mon Sep 17 00:00:00 2001 From: ngouy Date: Thu, 19 Dec 2024 14:33:38 -0500 Subject: [PATCH] feat(client): obfuscate token while logging in debug mode --- src/clients/transporter.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/clients/transporter.js b/src/clients/transporter.js index 686e8e19..bbf75f28 100644 --- a/src/clients/transporter.js +++ b/src/clients/transporter.js @@ -23,9 +23,19 @@ const defaultTransportConfig = { }; }, }; + +const obfuscateToken = (options) => { + if (!options.token) return options; + + return { + ...options, + token: options.token.slice(0, 5) + '**********', + }; +}; + class Transporter { constructor(options, sideLoad = [], useDotJson = true) { - this.options = options; + this.options = obfuscateToken(options); this.sideLoad = sideLoad; this.useDotJson = useDotJson; this.authHandler = new AuthorizationHandler(this.options);