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

Issue 2002943002: CSP violation reports should report the pre-redirect URL. (Closed)

Created:
4 years, 7 months ago by Mike West
Modified:
4 years, 6 months ago
Reviewers:
jww, estark
CC:
blink-reviews, chromium-reviews, mkwst+watchlist-csp_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

CSP violation reports should report the pre-redirect URL. Before this patch, blocked cross-origin resource URLs are stripped down to their origin before being reported to a policy's `report-uri` (same-origin resources are reported in full). This doesn't match the specced behavior, which suggests that we ought to be reporting the originally requested URL, even if the blocked resource is the result of a redirect. That is, given a policy which blocks `<img src='https://example.test/img.jpg'>` directly, the report should contain `https://example.test/img.jpg`. If that URL is allowed, but redirects to `https://example.test/other.jpg`, which is blocked the report should still contain `https://example.test/img.jpg` (see the note in https://w3c.github.io/webappsec-csp/#create-violation-for-request for detail). This patch gets us ~halfway there, by altering the behavior of `stripURLForUseInReport` to take account of the redirect status of the blocked resource. If it has been redirected, we'll keep the status quo stripping behavior. If it hasn't been redirected, we'll report the entire URL. A future patch will get redirects working entirely correctly, but given the value of reporting for things like mixed content detection, I don't think it's worth waiting for a full patch; there's enough value here over the status quo to land it and merge it back a bit. BUG=613960 Committed: https://crrev.com/7fdaebc90aef59e3501139c327db46d2655a1275 Cr-Commit-Position: refs/heads/master@{#396726}

Patch Set 1 : Tests. #

Total comments: 2

Patch Set 2 : Rebase. #

Patch Set 3 : Rebase. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+149 lines, -88 lines) Patch
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/base-uri-deny.html View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/base-uri-deny-expected.txt View 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-cross-origin-image.html View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/1.1/securitypolicyviolation-block-cross-origin-image-expected.txt View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-uri-cross-origin.php View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-uri-cross-origin-expected.txt View 1 1 chunk +1 line, -1 line 0 comments Download
A third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-original-url.php View 1 chunk +45 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/mixedContent/strict-mode-image-blocked.https.html View 1 2 1 chunk +30 lines, -28 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/mixedContent/strict-mode-image-reportonly.https.php View 1 2 1 chunk +30 lines, -27 lines 0 comments Download
M third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.h View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp View 1 2 4 chunks +9 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.h View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp View 1 2 5 chunks +16 lines, -9 lines 0 comments Download
M third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp View 1 2 2 chunks +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/loader/MixedContentChecker.h View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/loader/MixedContentChecker.cpp View 1 2 3 chunks +3 lines, -3 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 19 (8 generated)
Mike West
Emily, Joel: if you have some time this week, I have ~2 CSP reporting patches ...
4 years, 7 months ago (2016-05-23 10:15:57 UTC) #2
Mike West
Ping. :)
4 years, 7 months ago (2016-05-25 19:12:09 UTC) #4
estark
lgtm with a CL description nit: it took me a while to understand what the ...
4 years, 7 months ago (2016-05-25 22:58:24 UTC) #5
jww
lgtm2, with a question on one of your tests. I also second estark@'s confusion and ...
4 years, 7 months ago (2016-05-26 00:14:00 UTC) #6
jww
On 2016/05/26 00:14:00, jww wrote: > lgtm2, with a question on one of your tests. ...
4 years, 7 months ago (2016-05-26 00:14:38 UTC) #7
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2002943002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2002943002/60001
4 years, 6 months ago (2016-05-30 12:56:09 UTC) #10
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 6 months ago (2016-05-30 13:46:48 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2002943002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2002943002/60001
4 years, 6 months ago (2016-05-30 14:43:05 UTC) #15
commit-bot: I haz the power
Committed patchset #3 (id:60001)
4 years, 6 months ago (2016-05-30 14:46:38 UTC) #16
Mike West
I've updated the tests, and fixed an issue with the (newly-landed) mixed content checks as ...
4 years, 6 months ago (2016-05-30 14:46:40 UTC) #17
commit-bot: I haz the power
4 years, 6 months ago (2016-05-30 14:47:59 UTC) #19
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/7fdaebc90aef59e3501139c327db46d2655a1275
Cr-Commit-Position: refs/heads/master@{#396726}

Powered by Google App Engine
This is Rietveld 408576698