Skip to content

Commit fb384c9

Browse files
committed
Merge remote-tracking branch 'glynnbird/scrubauth' into HEAD
2 parents 4a3f525 + 0f7752d commit fb384c9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/nano.js

+14
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ module.exports = exports = nano = function dbScope(cfg) {
6060
return db;
6161
}
6262
}
63+
64+
function scrub(str) {
65+
if (str) {
66+
str = str.replace(/\/\/(.*)@/,"//XXXXXX:XXXXXX@");
67+
}
68+
return str;
69+
}
6370

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

234+
// scrub credentials
235+
req.uri = scrub(req.uri);
236+
rh.uri = scrub(rh.uri);
237+
if (req.headers.cookie) {
238+
req.headers.cookie = "XXXXXXX";
239+
}
240+
227241
callback(errs.merge({
228242
message: 'couch returned ' + rh.statusCode,
229243
scope: 'couch',

0 commit comments

Comments
 (0)