Skip to content

Commit

Permalink
Redact basic auth URLs before printing to log
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndrsn committed Jun 2, 2017
1 parent 32d775e commit 9e13c70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "medic-configurer-beta",
"version": "1.0.43",
"version": "1.0.44",
"description": "Configure Medic Mobile deployments",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 3 additions & 1 deletion src/lib/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ module.exports.warn = (...args) => logAtLevel('WARN', ...args);

function logAtLevel(level, ...args) {
args.unshift(level);
console.log.apply(console.log, args);
console.log.apply(console.log, args.map(redactUrls));
}

const redactUrls = s => s && s.toString().replace(/(http[s]?:\/\/[^:]*):[^@]*@/g, '$1:****@');

0 comments on commit 9e13c70

Please sign in to comment.