File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ var request = require ( '../' ) . defaults ( { json : true } ) ; ;
4+ var t = require ( 'chai' ) . assert ;
5+
6+ describe ( 'Information Leak' , function ( ) {
7+
8+ it ( 'should not forward cookie headers when the request has a redirect' , function ( done ) {
9+
10+ request ( {
11+ url : 'https://httpbingo.org/redirect-to?url=http://httpbingo.org/cookies' ,
12+ headers : {
13+ 'Content-Type' : 'application/json' ,
14+ 'cookie' : 'ajs_anonymous_id=1234567890' ,
15+ 'authorization' : 'Bearer eyJhb12345abcdef'
16+ } ,
17+ json :true
18+ } , function ( err , response , body ) {
19+ t . strictEqual ( Object . keys ( body ) . length , 0 ) ;
20+ done ( ) ;
21+ } ) ;
22+ } ) ;
23+
24+ it ( 'should not forward authorization headers when the request has a redirect' , function ( done ) {
25+
26+ request ( {
27+ url : 'https://httpbingo.org/redirect-to?url=http://httpbingo.org/bearer' ,
28+ headers : {
29+ 'Content-Type' : 'application/json' ,
30+ 'cookie' : 'ajs_anonymous_id=1234567890' ,
31+ 'authorization' : 'Bearer eyJhb12345abcdef'
32+ }
33+ } , function ( err , response , body ) {
34+ t . strictEqual ( body , '' ) ;
35+ done ( ) ;
36+ } ) ;
37+ } ) ;
38+
39+ } ) ;
You can’t perform that action at this time.
0 commit comments