From 32cb2f909e20d9ed89d662c6b1c16af513529c05 Mon Sep 17 00:00:00 2001 From: FelisCatus Date: Sat, 5 Aug 2017 22:28:11 -0400 Subject: [PATCH] Remove values for a few keys from exported log for privacy. Fix #1147. --- omega-target/src/log.coffee | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/omega-target/src/log.coffee b/omega-target/src/log.coffee index 1e99d58..ebbbfce 100644 --- a/omega-target/src/log.coffee +++ b/omega-target/src/log.coffee @@ -1,6 +1,14 @@ ### @module omega-target/log ### Log = require './log' +replacer = (key, value) => + switch key + # Hide values for a few keys with privacy concerns. + when "username", "password", "host", "port" + return "" + else + value + # Log is used as singleton. # coffeelint: disable=missing_fat_arrows module.exports = Log = @@ -20,7 +28,7 @@ module.exports = Log = else if obj instanceof Error obj.stack || obj.message else - JSON.stringify(obj, null, 4) + JSON.stringify(obj, replacer, 4) else if typeof obj == 'function' if obj.name ""