egg-cookies
Advanced tools
Comparing version 2.8.2 to 2.8.3
@@ -118,10 +118,14 @@ 'use strict'; | ||
const userAgent = this.ctx.get('user-agent'); | ||
let isSameSiteNone = false; | ||
if (opts.sameSite && typeof opts.sameSite === 'string' && opts.sameSite.toLowerCase() === 'none') { | ||
if (!this.secure || (userAgent && !this.isSameSiteNoneCompatible(userAgent))) { | ||
isSameSiteNone = true; | ||
if (opts.secure === false || !this.secure || (userAgent && !this.isSameSiteNoneCompatible(userAgent))) { | ||
// Non-secure context or Incompatible clients, don't send SameSite=None property | ||
opts.sameSite = false; | ||
isSameSiteNone = false; | ||
} | ||
} | ||
if (opts.partitioned) { | ||
if (!this.secure || (userAgent && !this.isPartitionedCompatible(userAgent))) { | ||
// allow to set partitioned: secure=true and sameSite=none and chrome >= 118 | ||
if (!isSameSiteNone || opts.secure === false || !this.secure || (userAgent && !this.isPartitionedCompatible(userAgent))) { | ||
// Non-secure context or Incompatible clients, don't send partitioned property | ||
@@ -186,6 +190,7 @@ opts.partitioned = false; | ||
isPartitionedCompatible(userAgent) { | ||
// Chrome >= 114.0.0.0 | ||
// support: Chrome >= 114.0.0.0 | ||
// default enable: Chrome >= 118.0.0.0 | ||
// https://developers.google.com/privacy-sandbox/3pcd/chips | ||
const result = this._parseChromiumAndMajorVersion(userAgent); | ||
if (result.chromium) return result.majorVersion >= 114; | ||
if (result.chromium) return result.majorVersion >= 118; | ||
return false; | ||
@@ -192,0 +197,0 @@ } |
{ | ||
"name": "egg-cookies", | ||
"version": "2.8.2", | ||
"version": "2.8.3", | ||
"description": "cookies module for egg", | ||
@@ -5,0 +5,0 @@ "files": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28380
472