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

Issue 2490943002: Block 'javascript:' navigation in the correct document. (Closed)

Created:
4 years, 1 month ago by Mike West
Modified:
4 years, 1 month ago
CC:
blink-reviews, blink-reviews-html_chromium.org, chromium-reviews, dglazkov+blink
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Block 'javascript:' navigation in the correct document. While working through [1], I noticed that Blink blocks 'javascript:' URL navigation in the _target_ document as opposed to in the _navigating_ document. This is particularly incorrect for `<iframe>`. This patch corrects the targeting. As a drive-by, this patch also ensures that we fire a `SecurityPolicyViolationEvent` for all CSP events. Previously, we fired only _unique_ CSP events. This optimization is meant to reduce traffic to a server (as completely duplicate reports are ~useless), but inadvertently blocked DOM events as well. The change to `ContentSecurityPolicy::reportViolation` fixes that. [1]: https://github.com/w3c/webappsec-csp/issues/127 R=jochen@chromium.org Committed: https://crrev.com/cab8b9f289ebe22d5e5ad79f6150cf729ef5079c Cr-Commit-Position: refs/heads/master@{#431539}

Patch Set 1 #

Total comments: 5

Patch Set 2 : feedback. #

Patch Set 3 : remove redundant tests #

Total comments: 3

Patch Set 4 : feedback #

Unified diffs Side-by-side diffs Delta from patch set Stats (+121 lines, -96 lines) Patch
D third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/inline-script-blocked-javascript-url.html View 1 2 1 chunk +0 lines, -10 lines 0 comments Download
D third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/inline-script-blocked-javascript-url-expected.txt View 1 2 1 chunk +0 lines, -6 lines 0 comments Download
D third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/javascript-url-allowed.html View 1 2 1 chunk +0 lines, -12 lines 0 comments Download
D third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/javascript-url-allowed-expected.txt View 1 2 1 chunk +0 lines, -5 lines 0 comments Download
D third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/javascript-url-blocked.html View 1 2 1 chunk +0 lines, -12 lines 0 comments Download
D third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/javascript-url-blocked-expected.txt View 1 2 1 chunk +0 lines, -6 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/navigation/to-javascript-url.html View 1 2 3 1 chunk +72 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/resources/csp.php View 1 chunk +4 lines, -0 lines 0 comments Download
D third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/resources/javascript-url.pl View 1 2 1 chunk +0 lines, -19 lines 0 comments Download
M third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp View 1 1 chunk +29 lines, -25 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp View 1 2 chunks +16 lines, -1 line 0 comments Download

Messages

Total messages: 20 (11 generated)
Mike West
foolip@: WDYT?
4 years, 1 month ago (2016-11-10 07:29:58 UTC) #6
foolip
I didn't totally understand what's going on, so something more in touch with CSP should ...
4 years, 1 month ago (2016-11-10 09:25:01 UTC) #7
Mike West
I improved the tests. :) Debugging those tests uncovered two issues: 1. `<iframe src="javascript:">` never ...
4 years, 1 month ago (2016-11-10 12:44:52 UTC) #10
foolip
test lgtm % nits https://codereview.chromium.org/2490943002/diff/1/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/navigation/to-javascript-url.html File third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/navigation/to-javascript-url.html (right): https://codereview.chromium.org/2490943002/diff/1/third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/navigation/to-javascript-url.html#newcode14 third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/navigation/to-javascript-url.html:14: assert_equals(element.contentDocument.body.innerText, ""); On 2016/11/10 12:44:52, ...
4 years, 1 month ago (2016-11-11 09:39:40 UTC) #11
foolip
ok, code also lgtm, if there's no other reviewer in sight :)
4 years, 1 month ago (2016-11-11 09:42:40 UTC) #12
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/2490943002/60001
4 years, 1 month ago (2016-11-11 09:59:51 UTC) #15
Mike West
Thanks, foolip@. :)
4 years, 1 month ago (2016-11-11 10:00:30 UTC) #16
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years, 1 month ago (2016-11-11 11:15:21 UTC) #18
commit-bot: I haz the power
4 years, 1 month ago (2016-11-11 11:18:17 UTC) #20
Message was sent while issue was closed.
Patchset 4 (id:??) landed as
https://crrev.com/cab8b9f289ebe22d5e5ad79f6150cf729ef5079c
Cr-Commit-Position: refs/heads/master@{#431539}

Powered by Google App Engine
This is Rietveld 408576698