diff options
author | mkwst <mkwst@chromium.org> | 2016-03-15 03:07:52 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-15 10:09:31 +0000 |
commit | e1a295845cbc338a564dc04e6e3e69b29ba7862f (patch) | |
tree | 00535f752a8faa939a4d646ca0215423e93e8ee6 /ios/net | |
parent | 752434c777d2e7b445e37629bf89ecc7c38c7c5c (diff) | |
download | chromium_src-e1a295845cbc338a564dc04e6e3e69b29ba7862f.zip chromium_src-e1a295845cbc338a564dc04e6e3e69b29ba7862f.tar.gz chromium_src-e1a295845cbc338a564dc04e6e3e69b29ba7862f.tar.bz2 |
SameSite: Implement 'Strict'/'Lax' attribute parsing.
https://tools.ietf.org/html/draft-west-first-party-cookies-06 introduced
the notion of "Strict" or "Lax" enforcement of the "SameSite" attribute.
This patch implements the infrastructure changes necessary to support
that distinction, but does not yet implement the behavioral change
(that is, after this patch, `SameSite` will be rejected, while
`SameSite=Strict` and `SameSite=Lax` will have the same behavior that
`SameSite` alone has today).
Most of this patch is occupied with the fairly mechanical process of
swapping out a new 'CookieSameSite' enum for the existing boolean in
various constructors and setters. The most interesting piece is the
change to the storage backend, which now stores 0, 1, or 2 in the
database to represent the possible values, rather than 0 or 1 to
represent the boolean.
BUG=459154
Review URL: https://codereview.chromium.org/1773133002
Cr-Commit-Position: refs/heads/master@{#381201}
Diffstat (limited to 'ios/net')
-rw-r--r-- | ios/net/cookies/cookie_cache_unittest.cc | 3 | ||||
-rw-r--r-- | ios/net/cookies/cookie_store_ios.h | 2 | ||||
-rw-r--r-- | ios/net/cookies/cookie_store_ios.mm | 2 | ||||
-rw-r--r-- | ios/net/cookies/cookie_store_ios_unittest.mm | 5 | ||||
-rw-r--r-- | ios/net/cookies/system_cookie_util.mm | 6 | ||||
-rw-r--r-- | ios/net/cookies/system_cookie_util_unittest.mm | 6 |
6 files changed, 12 insertions, 12 deletions
diff --git a/ios/net/cookies/cookie_cache_unittest.cc b/ios/net/cookies/cookie_cache_unittest.cc index 3aba46d..188d0bc 100644 --- a/ios/net/cookies/cookie_cache_unittest.cc +++ b/ios/net/cookies/cookie_cache_unittest.cc @@ -18,7 +18,8 @@ CanonicalCookie MakeCookie(const GURL& url, const std::string& name, const std::string& value) { return CanonicalCookie(url, name, value, url.host(), url.path(), base::Time(), - base::Time(), base::Time(), false, false, false, + base::Time(), base::Time(), false, false, + net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT); } diff --git a/ios/net/cookies/cookie_store_ios.h b/ios/net/cookies/cookie_store_ios.h index c80e7d3e..4a08929 100644 --- a/ios/net/cookies/cookie_store_ios.h +++ b/ios/net/cookies/cookie_store_ios.h @@ -128,7 +128,7 @@ class CookieStoreIOS : public net::CookieStore, base::Time last_access_time, bool secure, bool http_only, - bool same_site, + CookieSameSite same_site, bool enforce_strict_secure, CookiePriority priority, const SetCookiesCallback& callback) override; diff --git a/ios/net/cookies/cookie_store_ios.mm b/ios/net/cookies/cookie_store_ios.mm index 32d760f..78fb510 100644 --- a/ios/net/cookies/cookie_store_ios.mm +++ b/ios/net/cookies/cookie_store_ios.mm @@ -449,7 +449,7 @@ void CookieStoreIOS::SetCookieWithDetailsAsync( base::Time last_access_time, bool secure, bool http_only, - bool same_site, + CookieSameSite same_site, bool enforce_strict_secure, CookiePriority priority, const SetCookiesCallback& callback) { diff --git a/ios/net/cookies/cookie_store_ios_unittest.mm b/ios/net/cookies/cookie_store_ios_unittest.mm index c436cc9..af2c94e 100644 --- a/ios/net/cookies/cookie_store_ios_unittest.mm +++ b/ios/net/cookies/cookie_store_ios_unittest.mm @@ -100,7 +100,7 @@ class RoundTripTestCookieStore : public net::CookieStore { base::Time last_access_time, bool secure, bool http_only, - bool same_site, + CookieSameSite same_site, bool enforce_strict_secure, CookiePriority priority, const SetCookiesCallback& callback) override { @@ -264,8 +264,7 @@ class TestPersistentCookieStore base::Time(), // last_access false, // secure false, // httponly - false, // same_site - net::COOKIE_PRIORITY_DEFAULT); + net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT); cookies.push_back(bad_canonical_cookie); loaded_callback_.Run(cookies); } diff --git a/ios/net/cookies/system_cookie_util.mm b/ios/net/cookies/system_cookie_util.mm index 444a545..9c371dc 100644 --- a/ios/net/cookies/system_cookie_util.mm +++ b/ios/net/cookies/system_cookie_util.mm @@ -72,8 +72,10 @@ net::CanonicalCookie CanonicalCookieFromSystemCookie( base::SysNSStringToUTF8([cookie domain]), base::SysNSStringToUTF8([cookie path]), ceation_time, base::Time::FromDoubleT([[cookie expiresDate] timeIntervalSince1970]), - base::Time(), [cookie isSecure], [cookie isHTTPOnly], false, - net::COOKIE_PRIORITY_DEFAULT); + base::Time(), [cookie isSecure], [cookie isHTTPOnly], + // TODO(mkwst): When iOS begins to support 'SameSite' and 'Priority' + // attributes, pass them through here. + net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT); } // Converts net::CanonicalCookie to NSHTTPCookie. diff --git a/ios/net/cookies/system_cookie_util_unittest.mm b/ios/net/cookies/system_cookie_util_unittest.mm index 0273809..ba97b22 100644 --- a/ios/net/cookies/system_cookie_util_unittest.mm +++ b/ios/net/cookies/system_cookie_util_unittest.mm @@ -31,8 +31,7 @@ void CheckSystemCookie(const base::Time& expires, bool secure, bool httponly) { base::Time(), // creation expires, base::Time(), // last_access - secure, httponly, - false, // same_site + secure, httponly, net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT); // Convert it to system cookie. base::scoped_nsobject<NSHTTPCookie> system_cookie( @@ -125,8 +124,7 @@ TEST(CookieUtil, SystemCookieFromBadCanonicalCookie) { base::Time(), // last_access false, // secure false, // httponly - false, // same_site - net::COOKIE_PRIORITY_DEFAULT); + net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT); // Convert it to system cookie. base::scoped_nsobject<NSHTTPCookie> system_cookie( [SystemCookieFromCanonicalCookie(bad_canonical_cookie) retain]); |