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

Issue 1742923002: Commit empty document instead of canceling the load for blocked CSP/XFO responses. (Closed)

Created:
4 years, 10 months ago by alexmos
Modified:
4 years, 9 months ago
Reviewers:
Nate Chapin, Mike West
CC:
blink-reviews, chromium-reviews, gavinp+loader_chromium.org, Nate Chapin, loading-reviews_chromium.org, site-isolation-reviews_chromium.org, tyoshino+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Commit empty document instead of canceling the load for blocked CSP/XFO responses. Currently, loads that are blocked due to X-Frame-Options or CSP frame-ancestors are canceled (firing DidFailProvisionalLoad). As part of blocking, the current Document's origin is also changed to unique, and the load event is fired in the FrameOwner, presumably so that the load looks like a normal cross-origin load, where one can't discover whether or not it was blocked. The current implementation means that if the frame was showing another page before attempting the blocked load, that old page will still be showing and interactive after the block. However, the old page's origin becomes unique, so it loses ability to communicate with its original origin. This is not only confusing, but also seems dangerous, as it gives someone an ability to revoke the effective origin of a page by navigating it to something known to be blocked. Besides DoS, this also gives an attacker a way to probe if the block happened or not: if the attacker owns the subframe's current page and the navigation is blocked, the current page will keep existing and can check in with the server. Additionally, this behavior is not compliant with the spec (https://www.w3.org/TR/CSP2/#directive-frame-ancestors), which says that the user agent should: - Act as if it received an empty HTTP 200 response. - Redirect the user to a friendly error page which provides the option of opening the blocked page in a new top-level browsing context. This CL changes things to follow the first option in the spec and pretend that a blocked frame receives an empty 200 response. It still sets the unique origin on the resulting Document, since that is also part of the spec (the spec actually says to sandbox the Document fully and not just with SandboxOrigin, but that change can be done separately if desired, as it will likely break a bunch of layout tests). The load event on the FrameOwner will now be fired during the regular commit process on the empty document, as opposed to special logic in DocumentLoader::cancelLoadAfterXFrameOptionsOrCSPDenied. The original motivation for this change was that canceling blocked loads led to problems with cross-process iframes, since the blocking happened after process swap, when the browser process assumes the frame's new process is going to commit, but it doesn't. This change is more compatible with OOPIFs, and in fact fixes a bunch of layout tests with --site-per-process and all the problems mentioned in issue 584845 without any special logic in content/. BUG=584845 TEST=http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/* and http/tests/security/XFrameOptions/* still pass Committed: https://crrev.com/77f6ed50529fb670db4cb3989bae5d93515a33a5 Cr-Commit-Position: refs/heads/master@{#378762}

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : Cleanup #

Patch Set 4 : Update expectations for XFO layout tests #

Total comments: 2

Patch Set 5 : Address japhet@'s comment #

Messages

Total messages: 16 (8 generated)
alexmos
Mike, what do you think about this change and my reasoning in the description? Basically, ...
4 years, 9 months ago (2016-03-01 07:31:47 UTC) #5
Mike West
This LGTM, though I wonder if it means we ought to change the behavior of ...
4 years, 9 months ago (2016-03-01 19:42:25 UTC) #6
Nate Chapin
https://codereview.chromium.org/1742923002/diff/60001/third_party/WebKit/Source/core/dom/DocumentInit.cpp File third_party/WebKit/Source/core/dom/DocumentInit.cpp (right): https://codereview.chromium.org/1742923002/diff/60001/third_party/WebKit/Source/core/dom/DocumentInit.cpp#newcode114 third_party/WebKit/Source/core/dom/DocumentInit.cpp:114: DocumentLoader* documentLoader = loader->provisionalDocumentLoader() ? loader->provisionalDocumentLoader() : loader->documentLoader(); Is ...
4 years, 9 months ago (2016-03-01 20:26:11 UTC) #8
alexmos
Thanks! Nate - I fixed the loader check and left a question there for Mike. ...
4 years, 9 months ago (2016-03-02 01:30:56 UTC) #9
Mike West
On 2016/03/02 at 01:30:56, alexmos wrote: > Thanks! Nate - I fixed the loader check ...
4 years, 9 months ago (2016-03-02 13:57:11 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1742923002/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1742923002/80001
4 years, 9 months ago (2016-03-02 15:54:17 UTC) #13
commit-bot: I haz the power
Committed patchset #5 (id:80001)
4 years, 9 months ago (2016-03-02 17:05:02 UTC) #14
commit-bot: I haz the power
4 years, 9 months ago (2016-03-02 17:06:41 UTC) #16
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/77f6ed50529fb670db4cb3989bae5d93515a33a5
Cr-Commit-Position: refs/heads/master@{#378762}

Powered by Google App Engine
This is Rietveld 408576698