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

weird headers getting passed through #311

Open
mandric opened this issue Feb 9, 2016 · 2 comments
Open

weird headers getting passed through #311

mandric opened this issue Feb 9, 2016 · 2 comments

Comments

@mandric
Copy link

mandric commented Feb 9, 2016

There are two headers, uri and statusCode which are not valid http that are being returned from the httpAgent code see lib/nano.js line 195. This could lead to some sensitive information being leaked to the client if you're just passing headers through from CouchDB. Let me know if you think this is a real problem, I'd be happy to try to come up with a valid patch.

Here's an example:

$ curl -I http://localhost:3333
HTTP/1.1 200 OK
X-Powered-By: Express
etag: "2-8f443270fec4fb34bbc4ebca93a565d3"
date: Tue, 09 Feb 2016 05:24:29 GMT
Content-Type: application/json; charset=utf-8
cache-control: must-revalidate
statusCode: 200
uri: http://admin:secret@localhost:5984/test/foo
Content-Length: 713
Connection: keep-alive
var express = require('express'), 
    db = require('nano')('http://admin:secret@localhost:5984/test'), 
    app = module.exports = express();

app.get('/', function(request,response) {
  db.get('foo', function (error, body, headers) {
    for (var k in headers) {
      response.header(k, headers[k]);
    }
    if (error) {
      return response.status(error.statusCode).send(error.reason);
    }
    response.send(body, 200);
  });
});
app.listen(3333);
@mandric
Copy link
Author

mandric commented Feb 29, 2016

Just checking back here, any comments? Do you agree this is a bug/potential security issue?

@carlosduclos
Copy link

This repository has been merged into apache/couchdb-nano, please continue the discussion here

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants