Skip to content

Commit

Permalink
Merge pull request #436 from ngouy/hide-token-on-debug
Browse files Browse the repository at this point in the history
feat(client): obfuscate token while logging in debug mode
  • Loading branch information
blakmatrix authored Dec 20, 2024
2 parents b1f4683 + f39d050 commit 5230cde
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/clients/transporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5230cde

Please sign in to comment.