Skip to content

Commit

Permalink
Updated cookie to ensure SameSite is set as Strict #627 (#635)
Browse files Browse the repository at this point in the history
Fixes #627 .
  • Loading branch information
Abhirup-99 authored Jul 11, 2020
1 parent bc82070 commit 638728a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions www/js/lib/settingsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ define([], function () {
localStorageTest = false;
}
// Now test for document.cookie API support
document.cookie = 'tempKiwixCookieTest=working;expires=Fri, 31 Dec 9999 23:59:59 GMT';
document.cookie = 'tempKiwixCookieTest=working; expires=Fri, 31 Dec 9999 23:59:59 GMT; SameSite=Strict';
var kiwixCookieTest = /tempKiwixCookieTest=working/.test(document.cookie);
// Remove test value by expiring the key
document.cookie = 'tempKiwixCookieTest=;expires=Thu, 01 Jan 1970 00:00:00 GMT';
document.cookie = 'tempKiwixCookieTest=; expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=Strict';
if (kiwixCookieTest) type = 'cookie';
// Prefer localStorage if supported due to some platforms removing cookies once the session ends in some contexts
if (localStorageTest) type = 'local_storage';
Expand Down Expand Up @@ -167,4 +167,4 @@ define([], function () {
hasItem: settingsStore.hasItem,
getBestAvailableStorageAPI: getBestAvailableStorageAPI
};
});
});

0 comments on commit 638728a

Please sign in to comment.