trim sensitive info from logs

This commit is contained in:
Dave Horton
2021-11-03 14:37:57 -04:00
parent f11feb7975
commit dcf27ba5d3
5 changed files with 15 additions and 13 deletions

View File

@@ -137,7 +137,9 @@ module.exports = function(srf, logger) {
const obj = Object.assign({}, app); const obj = Object.assign({}, app);
delete obj.requestor; delete obj.requestor;
delete obj.notifier; delete obj.notifier;
logger.info({app: obj}, `retrieved application for incoming call to ${req.locals.calledNumber}`); // eslint-disable-next-line no-unused-vars
const {call_hook, call_status_hook, ...appInfo} = obj; // mask sensitive data like user/pass on webhook
logger.info({app: appInfo}, `retrieved application for incoming call to ${req.locals.calledNumber}`);
req.locals.callInfo = new CallInfo({req, app, direction: CallDirection.Inbound}); req.locals.callInfo = new CallInfo({req, app, direction: CallDirection.Inbound});
next(); next();
} catch (err) { } catch (err) {

View File

@@ -33,7 +33,7 @@ class TaskSay extends Task {
const salt = cs.callSid; const salt = cs.callSid;
const credentials = cs.getSpeechCredentials(vendor, 'tts'); const credentials = cs.getSpeechCredentials(vendor, 'tts');
this.logger.info({vendor, credentials}, 'Task:say - using vendor'); this.logger.info(`Task:say - using vendor: ${vendor}`);
this.ep = ep; this.ep = ep;
try { try {
if (!credentials) { if (!credentials) {

View File

@@ -100,15 +100,15 @@ class Requestor {
assert.ok(url, 'Requestor:request url was not provided'); assert.ok(url, 'Requestor:request url was not provided');
assert.ok, (['GET', 'POST'].includes(method), `Requestor:request method must be 'GET' or 'POST' not ${method}`); assert.ok, (['GET', 'POST'].includes(method), `Requestor:request method must be 'GET' or 'POST' not ${method}`);
const {url: urlInfo = hook, method: methodInfo = 'POST'} = hook; // mask user/pass
this.logger.debug({hook, payload}, `Requestor:request ${method} ${url}`); this.logger.debug({url: urlInfo, method: methodInfo, payload}, `Requestor:request ${method} ${url}`);
const startAt = process.hrtime(); const startAt = process.hrtime();
let buf; let buf;
try { try {
const sigHeader = generateSigHeader(payload, this.secret); const sigHeader = generateSigHeader(payload, this.secret);
const headers = {...sigHeader, ...this.authHeader}; const headers = {...sigHeader, ...this.authHeader};
this.logger.info({url, headers}, 'send webhook'); //this.logger.info({url, headers}, 'send webhook');
buf = isRelativeUrl(url) ? buf = isRelativeUrl(url) ?
await this.post(url, payload, headers) : await this.post(url, payload, headers) :
await bent(method, 'buffer', 200, 201, 202)(url, payload, headers); await bent(method, 'buffer', 200, 201, 202)(url, payload, headers);

14
package-lock.json generated
View File

@@ -8,7 +8,7 @@
"version": "0.6.7-rc5", "version": "0.6.7-rc5",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@jambonz/db-helpers": "^0.6.13", "@jambonz/db-helpers": "^0.6.14",
"@jambonz/mw-registrar": "^0.2.1", "@jambonz/mw-registrar": "^0.2.1",
"@jambonz/realtimedb-helpers": "^0.4.8", "@jambonz/realtimedb-helpers": "^0.4.8",
"@jambonz/stats-collector": "^0.1.5", "@jambonz/stats-collector": "^0.1.5",
@@ -376,9 +376,9 @@
} }
}, },
"node_modules/@jambonz/db-helpers": { "node_modules/@jambonz/db-helpers": {
"version": "0.6.13", "version": "0.6.14",
"resolved": "https://registry.npmjs.org/@jambonz/db-helpers/-/db-helpers-0.6.13.tgz", "resolved": "https://registry.npmjs.org/@jambonz/db-helpers/-/db-helpers-0.6.14.tgz",
"integrity": "sha512-7VXb1q8Jii76XFYMyIjsLr33w5s1DFUN1fjtU+r5PpZQuM7YXhVHfOW3q0652RMrEP2vqW2h6cpBNclvLPJzjg==", "integrity": "sha512-dWUjDb2If9NwUpUxlAJ4PbIWRyA1gZTkmiICix/f76yAF5aGCf0hgOiYXlh335BRYsX5By41yS7DkLXaTxbx9g==",
"dependencies": { "dependencies": {
"cidr-matcher": "^2.1.1", "cidr-matcher": "^2.1.1",
"debug": "^4.3.1", "debug": "^4.3.1",
@@ -5187,9 +5187,9 @@
"dev": true "dev": true
}, },
"@jambonz/db-helpers": { "@jambonz/db-helpers": {
"version": "0.6.13", "version": "0.6.14",
"resolved": "https://registry.npmjs.org/@jambonz/db-helpers/-/db-helpers-0.6.13.tgz", "resolved": "https://registry.npmjs.org/@jambonz/db-helpers/-/db-helpers-0.6.14.tgz",
"integrity": "sha512-7VXb1q8Jii76XFYMyIjsLr33w5s1DFUN1fjtU+r5PpZQuM7YXhVHfOW3q0652RMrEP2vqW2h6cpBNclvLPJzjg==", "integrity": "sha512-dWUjDb2If9NwUpUxlAJ4PbIWRyA1gZTkmiICix/f76yAF5aGCf0hgOiYXlh335BRYsX5By41yS7DkLXaTxbx9g==",
"requires": { "requires": {
"cidr-matcher": "^2.1.1", "cidr-matcher": "^2.1.1",
"debug": "^4.3.1", "debug": "^4.3.1",

View File

@@ -26,7 +26,7 @@
"jslint": "eslint app.js lib" "jslint": "eslint app.js lib"
}, },
"dependencies": { "dependencies": {
"@jambonz/db-helpers": "^0.6.13", "@jambonz/db-helpers": "^0.6.14",
"@jambonz/mw-registrar": "^0.2.1", "@jambonz/mw-registrar": "^0.2.1",
"@jambonz/realtimedb-helpers": "^0.4.8", "@jambonz/realtimedb-helpers": "^0.4.8",
"@jambonz/stats-collector": "^0.1.5", "@jambonz/stats-collector": "^0.1.5",