From 811d575cbff7f0a437957a499f43eb563d217010 Mon Sep 17 00:00:00 2001 From: Bastien Caudan Date: Wed, 24 Jun 2020 11:12:24 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8[RUMF-594]=20specify=20same=20site=20a?= =?UTF-8?q?ttribute=20on=20cookies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/cookie.ts | 2 +- packages/core/src/specHelper.ts | 2 +- test/e2e/scenario/helpers.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/src/cookie.ts b/packages/core/src/cookie.ts index cb3beb30b5..f525e2b0e7 100644 --- a/packages/core/src/cookie.ts +++ b/packages/core/src/cookie.ts @@ -39,7 +39,7 @@ export function setCookie(name: string, value: string, expireDelay: number) { const date = new Date() date.setTime(date.getTime() + expireDelay) const expires = `expires=${date.toUTCString()}` - document.cookie = `${name}=${value};${expires};path=/` + document.cookie = `${name}=${value};${expires};path=/;samesite=strict` } export function getCookie(name: string) { diff --git a/packages/core/src/specHelper.ts b/packages/core/src/specHelper.ts index 5b6aa37599..0b04764238 100644 --- a/packages/core/src/specHelper.ts +++ b/packages/core/src/specHelper.ts @@ -23,7 +23,7 @@ export function isIE() { export function clearAllCookies() { document.cookie.split(';').forEach((c) => { - document.cookie = c.replace(/=.*/, `=;expires=${new Date().toUTCString()};path=/`) + document.cookie = c.replace(/=.*/, `=;expires=${new Date().toUTCString()};path=/;samesite=strict`) }) } diff --git a/test/e2e/scenario/helpers.ts b/test/e2e/scenario/helpers.ts index 26c87746d2..8df20c9147 100644 --- a/test/e2e/scenario/helpers.ts +++ b/test/e2e/scenario/helpers.ts @@ -152,7 +152,7 @@ async function deleteAllCookies() { for (const cookie of cookies) { const eqPos = cookie.indexOf('=') const name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie - document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT` + document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;samesite=strict` } }) }