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

Issue 954233003: Enable SRI only for same origin and CORS content. (Closed)

Created:
5 years, 10 months ago by jww
Modified:
5 years, 9 months ago
Reviewers:
Mike West
CC:
blink-reviews, blink-reviews-dom_chromium.org, blink-reviews-html_chromium.org, blink-reviews-style_chromium.org, dglazkov+blink, eae+blinkwatch, gavinp+prerender_chromium.org, gavinp+loader_chromium.org, Nate Chapin, rwlbuis, sof, tyoshino+watch_chromium.org, Yoav Weiss
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Enabled SRI only for same origin and CORS content. According to the spec draft, Subresource Integrity should only work on same origin or CORS enabled content. This is to avoid security issues where SRI could be used to check the content of otherwise secret cross-origin resources. This CL modifies the script and style SRI checks to only be done on CORS and same origin content. If an integrity attribute is present and neither of those conditions hold, it adds a console warning. This requires modifications to fetch and script loader to pass forward the information that CORS has failed or the content is not same origin. BUG=438663 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=191682

Patch Set 1 #

Total comments: 12

Patch Set 2 : Move CORS checks into SubresourceIntegrity and fail to check integrity on non-CORS loads #

Patch Set 3 : Rebase on ToT #

Total comments: 10

Patch Set 4 : Addressed Mike's comments #

Patch Set 5 : Moved tests back to testharness #

Patch Set 6 : Rebase on ToT #

Patch Set 7 : Fixed test failures #

Unified diffs Side-by-side diffs Delta from patch set Stats (+426 lines, -35 lines) Patch
M LayoutTests/http/tests/security/resources/cors-script.php View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
A LayoutTests/http/tests/security/resources/cors-style.php View 1 2 3 1 chunk +10 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-script-cors.html View 1 2 3 4 1 chunk +21 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-script-cors-bad-integrity.html View 1 2 3 4 1 chunk +21 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-script-cors-bad-integrity-expected.txt View 1 2 3 4 5 6 1 chunk +5 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-script-cors-no-xorigin.html View 1 2 3 4 1 chunk +21 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-script-cors-no-xorigin-expected.txt View 1 2 3 4 5 6 1 chunk +5 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-script-no-cors.html View 1 2 3 4 1 chunk +20 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-script-no-cors-bad-integrity.html View 1 2 3 4 1 chunk +20 lines, -0 lines 0 comments Download
A + LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-script-no-cors-bad-integrity-expected.txt View 1 2 3 4 5 6 1 chunk +3 lines, -2 lines 0 comments Download
A + LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-script-no-cors-expected.txt View 1 2 3 4 1 chunk +3 lines, -2 lines 0 comments Download
A LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-script-no-cors-no-xorigin.html View 1 2 3 4 1 chunk +21 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-script-no-cors-no-xorigin-expected.txt View 1 2 3 4 1 chunk +5 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-script-no-cors-no-xorigin-with-creds.html View 1 2 3 4 1 chunk +22 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-script-no-cors-no-xorigin-with-creds-expected.txt View 1 2 3 4 1 chunk +5 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-style-cors.html View 1 2 3 4 1 chunk +23 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-style-cors-bad-integrity.html View 1 2 3 4 1 chunk +23 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-style-cors-no-xorigin.html View 1 2 3 4 1 chunk +22 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-style-no-cors.html View 1 2 3 4 1 chunk +23 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-style-no-cors-bad-integrity.html View 1 2 3 4 1 chunk +23 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-style-no-cors-no-xorigin.html View 1 2 3 4 1 chunk +22 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-style-no-cors-no-xorigin-with-creds.html View 1 2 3 4 1 chunk +22 lines, -0 lines 0 comments Download
M Source/core/dom/ScriptLoader.cpp View 1 2 2 chunks +7 lines, -3 lines 0 comments Download
M Source/core/fetch/Resource.h View 1 2 1 chunk +4 lines, -2 lines 0 comments Download
M Source/core/fetch/Resource.cpp View 1 2 3 4 5 1 chunk +8 lines, -2 lines 0 comments Download
M Source/core/fetch/ResourceFetcher.h View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M Source/core/fetch/ResourceFetcher.cpp View 1 2 3 4 5 2 chunks +2 lines, -2 lines 0 comments Download
M Source/core/fetch/ResourceLoader.cpp View 1 2 3 4 5 2 chunks +2 lines, -1 line 0 comments Download
M Source/core/fetch/ResourceLoaderHost.h View 1 1 chunk +5 lines, -1 line 0 comments Download
M Source/core/frame/SubresourceIntegrity.h View 1 1 chunk +2 lines, -1 line 0 comments Download
M Source/core/frame/SubresourceIntegrity.cpp View 1 3 chunks +7 lines, -1 line 0 comments Download
M Source/core/frame/SubresourceIntegrityTest.cpp View 1 2 3 3 chunks +46 lines, -15 lines 0 comments Download
M Source/core/html/HTMLLinkElement.cpp View 1 2 3 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 21 (6 generated)
jww
Mike, can you take a look? Thanks!
5 years, 10 months ago (2015-02-25 20:03:10 UTC) #2
Mike West
Thanks! Comments inline. https://codereview.chromium.org/954233003/diff/1/Source/core/dom/ScriptLoader.cpp File Source/core/dom/ScriptLoader.cpp (right): https://codereview.chromium.org/954233003/diff/1/Source/core/dom/ScriptLoader.cpp#newcode376 Source/core/dom/ScriptLoader.cpp:376: contextDocument->addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, "Cannot enforce integrity on ...
5 years, 10 months ago (2015-02-26 08:44:53 UTC) #3
jww
Mike, thanks for the comments, all spot on. I think I've addressed them here. Let ...
5 years, 9 months ago (2015-03-06 02:16:42 UTC) #4
Mike West
Code looks significantly better, thanks! I have some suggestions for tests, though. WDYT? https://codereview.chromium.org/954233003/diff/40001/LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-script-cors.html File ...
5 years, 9 months ago (2015-03-06 03:17:09 UTC) #5
Mike West
https://codereview.chromium.org/954233003/diff/40001/Source/core/frame/SubresourceIntegrityTest.cpp File Source/core/frame/SubresourceIntegrityTest.cpp (right): https://codereview.chromium.org/954233003/diff/40001/Source/core/frame/SubresourceIntegrityTest.cpp#newcode158 Source/core/frame/SubresourceIntegrityTest.cpp:158: response->setHTTPHeaderField("access-control-allow-origin", SecurityOrigin::create(allowOriginUrl)->toAtomicString()); It would be nice if this bit ...
5 years, 9 months ago (2015-03-06 03:19:37 UTC) #6
jww
https://codereview.chromium.org/954233003/diff/40001/LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-script-cors.html File LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-script-cors.html (right): https://codereview.chromium.org/954233003/diff/40001/LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-script-cors.html#newcode17 LayoutTests/http/tests/security/subresourceIntegrity/subresource-integrity-script-cors.html:17: description("The test passes if the script loads without any ...
5 years, 9 months ago (2015-03-06 08:24:22 UTC) #7
Mike West
LGTM % testharness.js. I really would like to see the interoperable bits tested in an ...
5 years, 9 months ago (2015-03-06 09:07:52 UTC) #8
jww
On 2015/03/06 09:07:52, Mike West wrote: > LGTM % testharness.js. I really would like to ...
5 years, 9 months ago (2015-03-06 22:14:11 UTC) #9
jww
On 2015/03/06 22:14:11, jww wrote: > On 2015/03/06 09:07:52, Mike West wrote: > > LGTM ...
5 years, 9 months ago (2015-03-06 23:49:47 UTC) #10
jww
Moved all the tests onto testharness. Just waiting for https://codereview.chromium.org/986393003 to land so that this ...
5 years, 9 months ago (2015-03-09 22:07:45 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/954233003/100001
5 years, 9 months ago (2015-03-10 23:23:45 UTC) #14
commit-bot: I haz the power
Try jobs failed on following builders: win_blink_rel on tryserver.blink (JOB_FAILED, http://build.chromium.org/p/tryserver.blink/builders/win_blink_rel/builds/54378)
5 years, 9 months ago (2015-03-11 02:24:10 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/954233003/120001
5 years, 9 months ago (2015-03-11 04:22:48 UTC) #19
commit-bot: I haz the power
Committed patchset #7 (id:120001) as https://src.chromium.org/viewvc/blink?view=rev&revision=191682
5 years, 9 months ago (2015-03-11 05:48:35 UTC) #20
jww
5 years, 9 months ago (2015-03-11 17:38:32 UTC) #21
Message was sent while issue was closed.
A revert of this CL (patchset #7 id:120001) has been created in
https://codereview.chromium.org/997083003/ by jww@chromium.org.

The reason for reverting is: Blink memory leak..

Powered by Google App Engine
This is Rietveld 408576698