You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by cs...@apache.org on 2017/08/16 11:56:17 UTC

[incubator-openwhisk-package-alarms] branch master updated: mask user apikeys in the logs (#85)

This is an automated email from the ASF dual-hosted git repository.

csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-package-alarms.git


The following commit(s) were added to refs/heads/master by this push:
     new 22f226f  mask user apikeys in the logs (#85)
22f226f is described below

commit 22f226f6ebcb1d8813ab76199cef03f87606ebef
Author: Jason Peterson <ja...@us.ibm.com>
AuthorDate: Wed Aug 16 07:56:15 2017 -0400

    mask user apikeys in the logs (#85)
---
 provider/Logger.js | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/provider/Logger.js b/provider/Logger.js
index b17deaa..d234edc 100644
--- a/provider/Logger.js
+++ b/provider/Logger.js
@@ -3,6 +3,8 @@ var moment = require('moment');
 var winston = require('winston');
 var safeStringify = require('json-stringify-safe');
 
+var apiKeyRegex = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}:[0-9a-zA-Z]{64}/g;
+
 var logger = new winston.Logger({
     transports: [
         new winston.transports.Console({
@@ -14,6 +16,11 @@ var logger = new winston.Logger({
                 return '[' + options.timestamp() +'] ['+ options.level.toUpperCase() +'] [??] [alarmsTrigger] ' +  options.message;
             }
         })
+    ],
+    filters: [
+        function maskAPIKeys(level, msg) {
+            return msg.replace(apiKeyRegex, 'xxxxxxxx');
+        }
     ]
 });
 

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].