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

Unified Diff: chrome/browser/signin/chrome_signin_helper.cc

Issue 2258483002: X-Chrome-Connected is stripped when it should not be in headers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: X-Chrome-Connected header is not removed if not originated from Google. Created 4 years, 4 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: chrome/browser/signin/chrome_signin_helper.cc
diff --git a/chrome/browser/signin/chrome_signin_helper.cc b/chrome/browser/signin/chrome_signin_helper.cc
index 6787db2f6026f1d4c358474b069de8e7e694bf78..c3911204de053269c6147e4a3c8ef5c05bd96fbb 100644
--- a/chrome/browser/signin/chrome_signin_helper.cc
+++ b/chrome/browser/signin/chrome_signin_helper.cc
@@ -118,11 +118,11 @@ ManageAccountsParams BuildManageAccountsParamsHelper(net::URLRequest* request,
} // namespace
-bool AppendMirrorRequestHeaderHelper(net::URLRequest* request,
- const GURL& redirect_url,
- ProfileIOData* io_data,
- int child_id,
- int route_id) {
+bool FixMirrorRequestHeaderHelper(net::URLRequest* request,
+ const GURL& redirect_url,
+ ProfileIOData* io_data,
+ int child_id,
+ int route_id) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if (io_data->IsOffTheRecord())
@@ -148,9 +148,23 @@ bool AppendMirrorRequestHeaderHelper(net::URLRequest* request,
profile_mode_mask |= PROFILE_MODE_INCOGNITO_DISABLED;
}
mmenke 2016/08/30 19:12:26 Think everything below this point may belong in a
Ramin Halavati 2016/09/01 10:41:44 Done. The removed part is now moved to signin_hea
- return AppendMirrorRequestHeaderIfPossible(
- request, redirect_url, io_data->google_services_account_id()->GetValue(),
- io_data->GetCookieSettings(), profile_mode_mask);
+ // If new url is eligible to have the header, return true, otherwise if
+ // redirecting to another site and x-chrome-header exists, and the redirected
mmenke 2016/08/30 19:12:26 x-chrome-header -> x-chrome-connected header (Or x
Ramin Halavati 2016/09/01 10:41:44 Done.
+ // site is not illigible and current site was illigible, remove it.
mmenke 2016/08/30 19:12:27 illigible -> eligible (x2)
Ramin Halavati 2016/09/01 10:41:44 Done.
+ if (AppendMirrorRequestHeaderIfPossible(
+ request, redirect_url,
+ io_data->google_services_account_id()->GetValue(),
+ io_data->GetCookieSettings(), profile_mode_mask)) {
+ return true;
mmenke 2016/08/30 19:12:27 The return value isn't used, and it isn't clear wh
Ramin Halavati 2016/09/01 10:41:44 Done.
+ } else {
mmenke 2016/08/30 19:12:27 Since you have the early return, this else isn't n
Ramin Halavati 2016/09/01 10:41:44 Done.
+ if (!redirect_url.is_empty() && // redirecting
+ request->extra_request_headers().HasHeader(
+ signin::kChromeConnectedHeader) && // x-chrome-header exists
mmenke 2016/08/30 19:12:27 Rather than inline comments, suggest writing out d
Ramin Halavati 2016/09/01 10:41:44 Done.
+ signin::IsUrlElligibleForXChromeConnectedHeader(request->url()) &&
+ !signin::IsUrlElligibleForXChromeConnectedHeader(redirect_url))
+ request->RemoveRequestHeaderByName(signin::kChromeConnectedHeader);
mmenke 2016/08/30 19:12:27 Use braces when an if condition takes multiple lin
Ramin Halavati 2016/09/01 10:41:44 Done.
+ }
+ return false;
}
void ProcessMirrorResponseHeaderIfExists(net::URLRequest* request,

Powered by Google App Engine
This is Rietveld 408576698