Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sampaguitas committed Feb 17, 2022
1 parent 3c0d686 commit 2d822ad
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/leak.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
'use strict';

var request = require('../').defaults({ json: true });;
var t = require('chai').assert;

describe('Information Leak', function () {

it('should not forward cookie headers when the request has a redirect', function (done) {

request({
url: 'https://httpbingo.org/cookies?url=https://google.com/',
headers: {
'Content-Type': 'application/json',
'cookie': 'ajs_anonymous_id=1234567890',
'authorization': 'Bearer eyJhb12345abcdef'
}
}, function (err, response, body) {
t.strictEqual(Object.keys(body).length, 0);
done();
});
});

it('should not forward authorization headers when the request has a redirect', function (done) {

request({
url: 'https://httpbingo.org/bearer?url=https://google.com/',
headers: {
'Content-Type': 'application/json',
'cookie': 'ajs_anonymous_id=1234567890',
'authorization': 'Bearer eyJhb12345abcdef'
}
}, function (err, response, body) {
t.strictEqual(body, undefined);
done();
});
});
});

0 comments on commit 2d822ad

Please sign in to comment.