@@ -179,39 +179,6 @@ describe('Authentication API (OIDC)', () => {
179179 } )
180180 } )
181181
182- describe ( 'with that cookie and a non-matching origin' , ( ) => {
183- let response
184- before ( done => {
185- alice . get ( '/private-for-alice.txt' )
186- . set ( 'Cookie' , cookie )
187- . set ( 'Origin' , bobServerUri )
188- . end ( ( err , res ) => {
189- response = res
190- done ( err )
191- } )
192- } )
193-
194- it ( 'should return a 403' , ( ) => {
195- expect ( response ) . to . have . property ( 'status' , 403 )
196- } )
197- } )
198-
199- describe ( 'without that cookie and a non-matching origin' , ( ) => {
200- let response
201- before ( done => {
202- alice . get ( '/private-for-alice.txt' )
203- . set ( 'Origin' , bobServerUri )
204- . end ( ( err , res ) => {
205- response = res
206- done ( err )
207- } )
208- } )
209-
210- it ( 'should return a 401' , ( ) => {
211- expect ( response ) . to . have . property ( 'status' , 401 )
212- } )
213- } )
214-
215182 describe ( 'with that cookie but without origin' , ( ) => {
216183 let response
217184 before ( done => {
@@ -228,19 +195,6 @@ describe('Authentication API (OIDC)', () => {
228195 } )
229196 } )
230197
231- describe ( 'with that cookie, private resource and no origin set' , ( ) => {
232- before ( done => {
233- alice . get ( '/private-for-alice.txt' )
234- . set ( 'Cookie' , cookie )
235- . end ( ( err , res ) => {
236- response = res
237- done ( err )
238- } )
239- } )
240-
241- it ( 'should return a 200' , ( ) => expect ( response ) . to . have . property ( 'status' , 200 ) )
242- } )
243-
244198 // How Mallory might set their cookie:
245199 describe ( 'with malicious cookie but without origin' , ( ) => {
246200 let response
@@ -342,8 +296,8 @@ describe('Authentication API (OIDC)', () => {
342296 } )
343297 } )
344298
345- it ( 'should return a 401 ' , ( ) => {
346- expect ( response ) . to . have . property ( 'status' , 401 )
299+ it ( 'should return a 403 ' , ( ) => {
300+ expect ( response ) . to . have . property ( 'status' , 403 ) // TODO: Should be 401?
347301 } )
348302 } )
349303
@@ -361,8 +315,8 @@ describe('Authentication API (OIDC)', () => {
361315 } )
362316 } )
363317
364- it ( 'should return a 401 ' , ( ) => {
365- expect ( response ) . to . have . property ( 'status' , 401 )
318+ it ( 'should return a 403 ' , ( ) => {
319+ expect ( response ) . to . have . property ( 'status' , 403 )
366320 } )
367321 } )
368322
@@ -379,8 +333,8 @@ describe('Authentication API (OIDC)', () => {
379333 } )
380334 } )
381335
382- it ( 'should return a 401 ' , ( ) => {
383- expect ( response ) . to . have . property ( 'status' , 401 )
336+ it ( 'should return a 403 ' , ( ) => {
337+ expect ( response ) . to . have . property ( 'status' , 403 )
384338 } )
385339 } )
386340
@@ -402,24 +356,7 @@ describe('Authentication API (OIDC)', () => {
402356 } )
403357 } )
404358
405- describe ( 'with malicious cookie and our origin' , ( ) => {
406- let response
407- before ( done => {
408- var malcookie = cookie . replace ( / c o n n e c t \. s i d = ( \S + ) / , 'connect.sid=l33th4x0rzp0wn4g3;' )
409- alice . get ( '/private-for-alice.txt' )
410- . set ( 'Cookie' , malcookie )
411- . set ( 'Origin' , aliceServerUri )
412- . end ( ( err , res ) => {
413- response = res
414- done ( err )
415- } )
416- } )
417-
418- it ( 'should return a 401' , ( ) => {
419- expect ( response ) . to . have . property ( 'status' , 401 )
420- } )
421- } )
422-
359+ // Authenticated but origin not OK
423360 describe ( 'with malicious cookie and a non-matching origin' , ( ) => {
424361 let response
425362 before ( done => {
@@ -433,8 +370,8 @@ describe('Authentication API (OIDC)', () => {
433370 } )
434371 } )
435372
436- it ( 'should return a 401 ' , ( ) => {
437- expect ( response ) . to . have . property ( 'status' , 401 )
373+ it ( 'should return a 403 ' , ( ) => {
374+ expect ( response ) . to . have . property ( 'status' , 403 )
438375 } )
439376 } )
440377 } )
0 commit comments