http: censor passphrase from logs.
This commit is contained in:
parent
ef387f969f
commit
322e74cbb7
@ -194,7 +194,7 @@ HTTPServer.prototype._init = function _init() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.use(function(req, res, send, next) {
|
this.use(function(req, res, send, next) {
|
||||||
var i, params, options, output, address;
|
var i, params, options, censored, output, address;
|
||||||
|
|
||||||
if (req.method === 'POST' && req.pathname === '/') {
|
if (req.method === 'POST' && req.pathname === '/') {
|
||||||
enforce(typeof req.body.method === 'string', 'Method must be a string.');
|
enforce(typeof req.body.method === 'string', 'Method must be a string.');
|
||||||
@ -205,13 +205,35 @@ HTTPServer.prototype._init = function _init() {
|
|||||||
|
|
||||||
params = {};
|
params = {};
|
||||||
options = {};
|
options = {};
|
||||||
|
censored = {};
|
||||||
|
|
||||||
softMerge(params, req.params, true);
|
softMerge(params, req.params, true);
|
||||||
softMerge(params, req.query, true);
|
softMerge(params, req.query, true);
|
||||||
softMerge(params, req.body);
|
softMerge(params, req.body);
|
||||||
|
softMerge(censored, params);
|
||||||
|
|
||||||
this.logger.debug('Params:');
|
this.logger.debug('Params:');
|
||||||
this.logger.debug(params);
|
|
||||||
|
// Censor sensitive data from logs.
|
||||||
|
if (censored.passphrase != null)
|
||||||
|
censored.passphrase = '<redacted>';
|
||||||
|
|
||||||
|
if (censored.old != null)
|
||||||
|
censored.old = '<redacted>';
|
||||||
|
|
||||||
|
if (censored.privateKey != null)
|
||||||
|
censored.privateKey = '<redacted>';
|
||||||
|
|
||||||
|
if (censored.accountKey != null)
|
||||||
|
censored.accountKey = '<redacted>';
|
||||||
|
|
||||||
|
if (censored.master != null)
|
||||||
|
censored.master = '<redacted>';
|
||||||
|
|
||||||
|
if (censored.mnemonic != null)
|
||||||
|
censored.mnemonic = '<redacted>';
|
||||||
|
|
||||||
|
this.logger.debug(censored);
|
||||||
|
|
||||||
if (params.id) {
|
if (params.id) {
|
||||||
enforce(typeof params.id === 'string', 'ID must be a string.');
|
enforce(typeof params.id === 'string', 'ID must be a string.');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user