couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [1/6] couchdb-nano git commit: scrub authentication details from the error response
Date Fri, 04 Dec 2015 09:16:54 GMT
Repository: couchdb-nano
Updated Branches:
  refs/heads/master cbab06519 -> c03b5528b


scrub authentication details from the error response


Project: http://git-wip-us.apache.org/repos/asf/couchdb-nano/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-nano/commit/0f7752d7
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-nano/tree/0f7752d7
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-nano/diff/0f7752d7

Branch: refs/heads/master
Commit: 0f7752d7e247fd55b79a7c0831596918487d1978
Parents: 1b65fee
Author: Glynn Bird <glynn.bird@gmail.com>
Authored: Thu Sep 10 08:41:05 2015 +0100
Committer: Glynn Bird <glynn.bird@gmail.com>
Committed: Thu Sep 10 08:41:05 2015 +0100

----------------------------------------------------------------------
 lib/nano.js | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-nano/blob/0f7752d7/lib/nano.js
----------------------------------------------------------------------
diff --git a/lib/nano.js b/lib/nano.js
index ab97228..0cd0bc4 100644
--- a/lib/nano.js
+++ b/lib/nano.js
@@ -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') {
@@ -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',


Mime
View raw message