Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Unified Diff: net/cookies/canonical_cookie.cc

Issue 1783813002: SameSite: Strict/Lax behavior. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@strict-lax
Patch Set: Comment. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/cookies/canonical_cookie.cc
diff --git a/net/cookies/canonical_cookie.cc b/net/cookies/canonical_cookie.cc
index 5647a22052b385efb283444ea0f583ae91d59ba0..89b5b4d5f90e2b178faa34d823f8fb212b972042 100644
--- a/net/cookies/canonical_cookie.cc
+++ b/net/cookies/canonical_cookie.cc
@@ -422,13 +422,21 @@ bool CanonicalCookie::IncludeForRequestURL(const GURL& url,
if (!IsOnPath(url.path()))
return false;
// Don't include same-site cookies for cross-site requests.
- //
- // TODO(mkwst): This currently treats both "strict" and "lax" SameSite cookies
- // in the same way. https://codereview.chromium.org/1783813002 will eventually
- // distinguish between them based on attributes of the request.
- if (SameSite() != CookieSameSite::NO_RESTRICTION &&
- !options.include_same_site()) {
- return false;
+ switch (SameSite()) {
+ case CookieSameSite::STRICT_MODE:
+ if (options.same_site_cookie_mode() !=
+ CookieOptions::SameSiteCookieMode::INCLUDE_STRICT_AND_LAX) {
+ return false;
+ }
+ break;
+ case CookieSameSite::LAX_MODE:
+ if (options.same_site_cookie_mode() ==
+ CookieOptions::SameSiteCookieMode::DO_NOT_INCLUDE) {
+ return false;
+ }
+ break;
+ default:
+ break;
}
return true;
« no previous file with comments | « net/base/registry_controlled_domains/registry_controlled_domain_unittest.cc ('k') | net/cookies/canonical_cookie_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698