@@ -350,7 +350,7 @@ describe('Set cookie', () => {
350350 } ) . toThrowError ( 'Partitioned Cookie must have Secure attributes' )
351351 } )
352352
353- it ( 'Should throw Error cookie with domain or path containing ";", "\\r", or "\\n"' , ( ) => {
353+ it ( 'Should throw Error cookie with domain, path, sameSite, or priority containing ";", "\\r", or "\\n"' , ( ) => {
354354 // domain
355355 expect ( ( ) => {
356356 serialize ( 'great_cookie' , 'banana' , { domain : 'example.com;evil' } )
@@ -372,6 +372,28 @@ describe('Set cookie', () => {
372372 expect ( ( ) => {
373373 serialize ( 'great_cookie' , 'banana' , { path : '/\nevil' } )
374374 } ) . toThrowError ( 'path must not contain ";", "\\r", or "\\n"' )
375+
376+ // sameSite
377+ expect ( ( ) => {
378+ serialize ( 'great_cookie' , 'banana' , { sameSite : 'Strict;evil' as 'Strict' } )
379+ } ) . toThrowError ( 'sameSite must not contain ";", "\\r", or "\\n"' )
380+ expect ( ( ) => {
381+ serialize ( 'great_cookie' , 'banana' , { sameSite : 'Strict\revil' as 'Strict' } )
382+ } ) . toThrowError ( 'sameSite must not contain ";", "\\r", or "\\n"' )
383+ expect ( ( ) => {
384+ serialize ( 'great_cookie' , 'banana' , { sameSite : 'Strict\nevil' as 'Strict' } )
385+ } ) . toThrowError ( 'sameSite must not contain ";", "\\r", or "\\n"' )
386+
387+ // priority
388+ expect ( ( ) => {
389+ serialize ( 'great_cookie' , 'banana' , { priority : 'High;evil' as 'High' } )
390+ } ) . toThrowError ( 'priority must not contain ";", "\\r", or "\\n"' )
391+ expect ( ( ) => {
392+ serialize ( 'great_cookie' , 'banana' , { priority : 'High\revil' as 'High' } )
393+ } ) . toThrowError ( 'priority must not contain ";", "\\r", or "\\n"' )
394+ expect ( ( ) => {
395+ serialize ( 'great_cookie' , 'banana' , { priority : 'High\nevil' as 'High' } )
396+ } ) . toThrowError ( 'priority must not contain ";", "\\r", or "\\n"' )
375397 } )
376398
377399 it ( 'Should throw Error for invalid cookie name' , ( ) => {
0 commit comments