Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Fix #77: don't show password in plaintext in console #82

Merged
merged 6 commits into from
Jan 2, 2019
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/api/src/transport/ws/ws.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,14 @@ class Ws extends JsonRpcBase {

// Don't print error if request rejected or not is not yet up...
if (!/(rejected|not yet up)/.test(result.error.message)) {
console.error(`${method}(${JSON.stringify(params)}): ${result.error.code}: ${result.error.message}`);
const dangerous_methods = ['signer_confirmRequest', 'signer_confirmRequestWithToken'];
let safe_params;
if (dangerous_methods.includes(method)) {
safe_params = params.slice();
safe_params[params.length - 1] = '***';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a comment somewhere here, to tell future devs what we're doing here, it might not be obvious at 1st sight.

}

console.error(`${method}(${JSON.stringify(`${safe_params || params}`)}): ${result.error.code}: ${result.error.message}`);
pmespresso marked this conversation as resolved.
Show resolved Hide resolved
}

const error = new TransportError(method, result.error.code, result.error.message);
Expand Down