Fix cookie warning

> Some cookies are misusing the recommended “SameSite“ attribute

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite
pull/1654/head
Simon Legner 3 years ago
parent 1040744f55
commit b67cf41c0a

@ -1,5 +1,5 @@
/* /*
* Cookies.js - 1.2.3 * Cookies.js - 1.2.3 (patched for SameSite=Strict and secure=true)
* https://github.com/ScottHamper/Cookies * https://github.com/ScottHamper/Cookies
* *
* This is free and unencumbered software released into the public domain. * This is free and unencumbered software released into the public domain.
@ -28,7 +28,8 @@
Cookies.defaults = { Cookies.defaults = {
path: '/', path: '/',
secure: false SameSite: 'Strict',
secure: true
}; };
Cookies.get = function (key) { Cookies.get = function (key) {
@ -58,6 +59,7 @@
return { return {
path: options && options.path || Cookies.defaults.path, path: options && options.path || Cookies.defaults.path,
domain: options && options.domain || Cookies.defaults.domain, domain: options && options.domain || Cookies.defaults.domain,
SameSite: options && options.SameSite || Cookies.defaults.SameSite,
expires: options && options.expires || Cookies.defaults.expires, expires: options && options.expires || Cookies.defaults.expires,
secure: options && options.secure !== undefined ? options.secure : Cookies.defaults.secure secure: options && options.secure !== undefined ? options.secure : Cookies.defaults.secure
}; };
@ -93,6 +95,7 @@
var cookieString = key + '=' + value; var cookieString = key + '=' + value;
cookieString += options.path ? ';path=' + options.path : ''; cookieString += options.path ? ';path=' + options.path : '';
cookieString += options.domain ? ';domain=' + options.domain : ''; cookieString += options.domain ? ';domain=' + options.domain : '';
cookieString += options.SameSite ? ';SameSite=' + options.SameSite : '';
cookieString += options.expires ? ';expires=' + options.expires.toUTCString() : ''; cookieString += options.expires ? ';expires=' + options.expires.toUTCString() : '';
cookieString += options.secure ? ';secure' : ''; cookieString += options.secure ? ';secure' : '';

Loading…
Cancel
Save