@@ -35,6 +35,8 @@ describe('Authentication API (OIDC) - With strict origins turned off', () => {
3535 const bobServerUri = `https://localhost:${ bobServerPort } `
3636 let bobDbPath = path . join ( __dirname , '../resources/accounts-strict-origin-off/bob/db' )
3737
38+ const trustedAppUri = 'https://trusted.app'
39+
3840 const serverConfig = {
3941 sslKey : path . join ( __dirname , '../keys/key.pem' ) ,
4042 sslCert : path . join ( __dirname , '../keys/cert.pem' ) ,
@@ -194,6 +196,18 @@ describe('Authentication API (OIDC) - With strict origins turned off', () => {
194196 } )
195197 } )
196198
199+ it ( 'should return a 401' , ( ) => expect ( response ) . to . have . property ( 'status' , 401 ) )
200+ } )
201+ describe ( 'and trusted app' , ( ) => {
202+ before ( done => {
203+ alice . get ( '/private-for-alice.txt' )
204+ . set ( 'Origin' , trustedAppUri )
205+ . end ( ( err , res ) => {
206+ response = res
207+ done ( err )
208+ } )
209+ } )
210+
197211 it ( 'should return a 401' , ( ) => expect ( response ) . to . have . property ( 'status' , 401 ) )
198212 } )
199213 } )
@@ -251,6 +265,21 @@ describe('Authentication API (OIDC) - With strict origins turned off', () => {
251265 // Even if origin checking is disabled, then this should return a 401 because cookies should not be trusted cross-origin
252266 it ( 'should return a 401' , ( ) => expect ( response ) . to . have . property ( 'status' , 401 ) )
253267 } )
268+
269+ describe ( 'and trusted app' , ( ) => {
270+ // Trusted apps are not supported when strictOrigin check is turned off
271+ before ( done => {
272+ alice . get ( '/private-for-alice.txt' )
273+ . set ( 'Cookie' , cookie )
274+ . set ( 'Origin' , trustedAppUri )
275+ . end ( ( err , res ) => {
276+ response = res
277+ done ( err )
278+ } )
279+ } )
280+
281+ it ( 'should return a 401' , ( ) => expect ( response ) . to . have . property ( 'status' , 401 ) )
282+ } )
254283 } )
255284
256285 describe ( 'with malicious cookie' , ( ) => {
@@ -310,6 +339,20 @@ describe('Authentication API (OIDC) - With strict origins turned off', () => {
310339
311340 it ( 'should return a 401' , ( ) => expect ( response ) . to . have . property ( 'status' , 401 ) )
312341 } )
342+
343+ describe ( 'and trusted app' , ( ) => {
344+ before ( done => {
345+ alice . get ( '/private-for-alice.txt' )
346+ . set ( 'Cookie' , malcookie )
347+ . set ( 'Origin' , trustedAppUri )
348+ . end ( ( err , res ) => {
349+ response = res
350+ done ( err )
351+ } )
352+ } )
353+
354+ it ( 'should return a 401' , ( ) => expect ( response ) . to . have . property ( 'status' , 401 ) )
355+ } )
313356 } )
314357 } )
315358 } )
0 commit comments