Skip to content

Commit

Permalink
prebid#5011 Fix to set Secure attribute on cookie when SameSite=none
Browse files Browse the repository at this point in the history
  • Loading branch information
goosemanjack committed Apr 1, 2020
1 parent 5af6c64 commit d5600c0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/storageManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ export function newStorageManager({gvlid, moduleName, moduleType} = {}) {
if (result && result.valid) {
const domainPortion = (domain && domain !== '') ? ` ;domain=${encodeURIComponent(domain)}` : '';
const expiresPortion = (expires && expires !== '') ? ` ;expires=${expires}` : '';
document.cookie = `${key}=${encodeURIComponent(value)}${expiresPortion}; path=/${domainPortion}${sameSite ? `; SameSite=${sameSite}` : ''}`;
var isNone = (sameSite != null && sameSite.toLowerCase() == 'none')
var secure = (isNone) ? '; Secure' : '';
document.cookie = `${key}=${encodeURIComponent(value)}${expiresPortion}; path=/${domainPortion}${sameSite ? `; SameSite=${sameSite}` : ''}${secure}`;
}
}
if (done && typeof done === 'function') {
Expand Down

0 comments on commit d5600c0

Please sign in to comment.