Commit 2387bd90 authored by Lily Chen's avatar Lily Chen Committed by Commit Bot

Add comments justifying code to bypass SameSite cookie restrictions

This adds comments to better explain use cases for adding the special
exceptions to SameSite cookie rules for chrome:// scheme pages that were
added in https://crrev.com/c/1904544.

Bug: 1007320
Change-Id: Iba4f6c20d2a4bbca6297be813ebdc9aa0437dcef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2227058
Commit-Queue: Lily Chen <chlily@chromium.org>
Commit-Queue: Maksim Orlovich <morlovich@chromium.org>
Auto-Submit: Lily Chen <chlily@chromium.org>
Reviewed-by: default avatarMaksim Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774338}
parent 6ce5d659
...@@ -1703,6 +1703,12 @@ bool ChromeContentBrowserClient::DoesWebUISchemeRequireProcessLock( ...@@ -1703,6 +1703,12 @@ bool ChromeContentBrowserClient::DoesWebUISchemeRequireProcessLock(
bool ChromeContentBrowserClient::ShouldTreatURLSchemeAsFirstPartyWhenTopLevel( bool ChromeContentBrowserClient::ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(
base::StringPiece scheme, base::StringPiece scheme,
bool is_embedded_origin_secure) { bool is_embedded_origin_secure) {
// This is needed to bypass the normal SameSite rules for any chrome:// page
// embedding a secure origin, regardless of the registrable domains of any
// intervening frames. For example, this is needed for browser UI to interact
// with SameSite cookies on accounts.google.com, which are used for logging
// into Cloud Print from chrome://print, for displaying a list of available
// accounts on the NTP (chrome://new-tab-page), etc.
if (is_embedded_origin_secure && scheme == content::kChromeUIScheme) if (is_embedded_origin_secure && scheme == content::kChromeUIScheme)
return true; return true;
#if BUILDFLAG(ENABLE_EXTENSIONS) #if BUILDFLAG(ENABLE_EXTENSIONS)
......
...@@ -532,6 +532,11 @@ ProfileNetworkContextService::CreateCookieManagerParams( ...@@ -532,6 +532,11 @@ ProfileNetworkContextService::CreateCookieManagerParams(
auto out = network::mojom::CookieManagerParams::New(); auto out = network::mojom::CookieManagerParams::New();
out->block_third_party_cookies = out->block_third_party_cookies =
cookie_settings.ShouldBlockThirdPartyCookies(); cookie_settings.ShouldBlockThirdPartyCookies();
// This allows cookies to be sent on https requests from chrome:// pages,
// ignoring SameSite attribute rules. For example, this is needed for browser
// UI to interact with SameSite cookies on accounts.google.com, which are used
// for logging into Cloud Print from chrome://print, for displaying a list
// of available accounts on the NTP (chrome://new-tab-page), etc.
out->secure_origin_cookies_allowed_schemes.push_back( out->secure_origin_cookies_allowed_schemes.push_back(
content::kChromeUIScheme); content::kChromeUIScheme);
#if BUILDFLAG(ENABLE_EXTENSIONS) #if BUILDFLAG(ENABLE_EXTENSIONS)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment