Skip to content
This repository has been archived by the owner on Nov 5, 2018. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'glynnbird/scrubauth' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
jhs committed Sep 13, 2015
2 parents 4a3f525 + 0f7752d commit fb384c9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/nano.js
Expand Up @@ -60,6 +60,13 @@ module.exports = exports = nano = function dbScope(cfg) {
return db;
}
}

function scrub(str) {
if (str) {
str = str.replace(/\/\/(.*)@/,"//XXXXXX:XXXXXX@");
}
return str;
}

function relax(opts, callback) {
if (typeof opts === 'function') {
Expand Down Expand Up @@ -224,6 +231,13 @@ module.exports = exports = nano = function dbScope(cfg) {
// fix cloudant issues where they give an erlang stacktrace as js
delete parsed.stack;

// scrub credentials
req.uri = scrub(req.uri);
rh.uri = scrub(rh.uri);
if (req.headers.cookie) {
req.headers.cookie = "XXXXXXX";
}

callback(errs.merge({
message: 'couch returned ' + rh.statusCode,
scope: 'couch',
Expand Down

0 comments on commit fb384c9

Please sign in to comment.