openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From csantan...@apache.org
Subject [incubator-openwhisk-package-alarms] branch master updated: mask user apikeys in the logs (#85)
Date Wed, 16 Aug 2017 11:56:17 GMT
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 <jasonpet@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" <commits@openwhisk.apache.org>'].

Mime
View raw message