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

Issue 2636193003: Fix cross-site subframe navigations that transfer back to original RFH. (Closed)

Created:
3 years, 11 months ago by alexmos
Modified:
3 years, 9 months ago
Reviewers:
Charlie Reis
CC:
chromium-reviews, jam, nasko+codewatch_chromium.org, darin-cc_chromium.org, creis+watch_chromium.org, site-isolation-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix cross-site subframe navigations that transfer back to original RFH. This fixes a bug where if an OOPIF at site A navigates to site B which redirects back to A, the navigation timed out because Transfer() was never called on transfer_navigation_handle_, and the pending RFH for B was never canceled. This is because UpdateStateForNavigate returned the current RFH early, due to checking CanSubframeSwapProcess before reaching those steps. Not calling Transfer() later led to the transferred request being dropped in ResourceDispatcherHostImpl::CompleteTransfer, due to not finding a matching entry in pending_loaders_. This CL fixes the CanSubframeSwapProcess check to be performed after calling Transfer() and canceling the pending RFH (if necessary). This uncovered another complication, which is that while redirects to data: and about: URLs are explicitly disallowed as unsafe (e.g., see DataProtocolHandler::IsSafeRedirectTarget), they are allowed when an extension uses the webRequest API to redirect certain URLs. One of the tests, ExtensionWebRequestApiTest.WebRequestDeclarative1, was exercising this: it had a subframe which made a same-site request that was redirected to data:,. Previously, in --site-per-process, it worked due to the ordering problem that this CL fixes: we first decided to transfer the request (IsRendererTransferNeededForNavigation returned true), then we returned the current RFH early due to CanSubframeSwapProcess returning |false| before calling Transfer(). With the fixed ordering, we were now also calling Transfer(), as we were expecting the data: request to be put into a new SiteInstance which didn't match the current one, yet the request was never transferred (we weren't spinning up a new pending RFH, and we weren't sending a Navigate IPC to the current RFH due to the is_transfer_to_same case in NavigateToEntry, so no one actually made a request to the data: URL). To address this, CanSubframeSwapProcess is changed to allow a process swap for such transfers to data: and about:. This changes behavior where these redirects were previously kept in the original SiteInstance, but this should be safer, and it should not break any scripting relationships (the redirect URLs are provided by an extension; the site that made the request that's being redirected can't expect to script the redirect target). BUG=681077, 660407, 659613 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation Review-Url: https://codereview.chromium.org/2636193003 Cr-Commit-Position: refs/heads/master@{#453800} Committed: https://chromium.googlesource.com/chromium/src/+/0431b6bc6c9bf5624cccf1121285392b07b74ec6

Patch Set 1 #

Patch Set 2 : Fix webRequest test and remove third return path from UpdateStateForNavigate #

Patch Set 3 : Second attempt at fix #

Patch Set 4 : Experiment #

Patch Set 5 : Try #3 #

Total comments: 14

Patch Set 6 : Rebase #

Patch Set 7 : Fix PlzNavigate #

Total comments: 2

Patch Set 8 : Rebase #

Patch Set 9 : Rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+95 lines, -25 lines) Patch
M content/browser/frame_host/render_frame_host_manager.h View 1 2 3 4 5 6 3 chunks +6 lines, -3 lines 0 comments Download
M content/browser/frame_host/render_frame_host_manager.cc View 1 2 3 4 5 6 10 chunks +54 lines, -22 lines 0 comments Download
M content/browser/site_per_process_browsertest.cc View 1 2 3 4 5 6 7 1 chunk +35 lines, -0 lines 0 comments Download

Messages

Total messages: 53 (44 generated)
alexmos
Charlie, can you please take a look? This is a fairly small fix but involves ...
3 years, 11 months ago (2017-01-25 22:30:55 UTC) #27
Charlie Reis
Thanks for investigating this, and sorry for the late review! I think the PlzNavigate transfer ...
3 years, 10 months ago (2017-02-02 22:40:46 UTC) #28
alexmos
Thanks for the review, Charlie! I've fixed the approach to also work for PlzNavigate. Let ...
3 years, 10 months ago (2017-02-14 21:16:07 UTC) #33
alexmos
Hey Charlie - just a gentle ping to bump this up in your review queue. ...
3 years, 9 months ago (2017-02-27 18:29:59 UTC) #35
Charlie Reis
Thanks for working through the PlzNavigate case, and sorry for the delay. New approach LGTM! ...
3 years, 9 months ago (2017-02-28 00:57:53 UTC) #36
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2636193003/160001
3 years, 9 months ago (2017-03-01 00:24:39 UTC) #46
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_tsan_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_tsan_rel_ng/builds/24031)
3 years, 9 months ago (2017-03-01 00:36:10 UTC) #48
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2636193003/160001
3 years, 9 months ago (2017-03-01 00:49:31 UTC) #50
commit-bot: I haz the power
3 years, 9 months ago (2017-03-01 02:53:30 UTC) #53
Message was sent while issue was closed.
Committed patchset #9 (id:160001) as
https://chromium.googlesource.com/chromium/src/+/0431b6bc6c9bf5624cccf1121285...

Powered by Google App Engine
This is Rietveld 408576698