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

Issue 714833002: [ServiceWorker] CSP support for ServiceWorker environment. (Closed)

Created:
6 years, 1 month ago by horo
Modified:
6 years, 1 month ago
Reviewers:
Mike West, nhiroki
CC:
blink-reviews, michaeln, jsbell+serviceworker_chromium.org, kenjibaheux+watch_chromium.org, tzik, serviceworker-reviews, nhiroki, falken, kinuko+serviceworker, horo+watch_chromium.org, jww
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Project:
blink
Visibility:
Public.

Description

[ServiceWorker] CSP support for ServiceWorker environment. According to the CSP spec, we have to check the Content-Security-Policy HTTP response header of the ServiceWorker script. https://w3c.github.io/webappsec/specs/content-security-policy/#processing-model-workers For example: When "Content-Security-Policy: script-src 'self'" is set, "importScripts('https://othersite/'); must fail. When "Content-Security-Policy: connect-src 'self'" is set, "fetch('https://othersite/data'); must fail. The changes in WebEmbeddedWorkerImpl.cpp introduce CSP check for ServiceWorker environment. The changes in FetchManager.cpp introduce CSP check for fech API. We need to set the CSP not only to the ServiceWorkerGlobalScope but also to the shadow page's document. The CSP in the shadow page's document will be used while handling the redirect responses in DocumentThreadableLoader::isAllowedByContentSecurityPolicy() BUG=432069 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=185630

Patch Set 1 : #

Total comments: 6

Patch Set 2 : else if #

Total comments: 8

Patch Set 3 : rebase #

Patch Set 4 : add FIXME #

Unified diffs Side-by-side diffs Delta from patch set Stats (+146 lines, -9 lines) Patch
A LayoutTests/http/tests/serviceworker/resources/service-worker-csp-worker.php View 1 1 chunk +98 lines, -0 lines 0 comments Download
A LayoutTests/http/tests/serviceworker/service-worker-csp.html View 1 2 3 1 chunk +20 lines, -0 lines 0 comments Download
M Source/modules/serviceworkers/FetchManager.cpp View 1 2 4 chunks +12 lines, -6 lines 0 comments Download
M Source/web/WebEmbeddedWorkerImpl.cpp View 1 2 7 chunks +16 lines, -3 lines 0 comments Download

Messages

Total messages: 22 (7 generated)
horo
nhiroki@ Could you please review?
6 years, 1 month ago (2014-11-11 11:13:09 UTC) #6
nhiroki
Looks good to me. I'm not familiar with CSP, so please ask an expert on ...
6 years, 1 month ago (2014-11-12 07:43:14 UTC) #7
horo
https://codereview.chromium.org/714833002/diff/80001/LayoutTests/http/tests/serviceworker/resources/service-worker-csp-worker.php File LayoutTests/http/tests/serviceworker/resources/service-worker-csp-worker.php (right): https://codereview.chromium.org/714833002/diff/80001/LayoutTests/http/tests/serviceworker/resources/service-worker-csp-worker.php#newcode36 LayoutTests/http/tests/serviceworker/resources/service-worker-csp-worker.php:36: } if ($directive == 'script') { On 2014/11/12 07:43:14, ...
6 years, 1 month ago (2014-11-12 08:25:41 UTC) #8
horo
mkwst@ Could you please review this?
6 years, 1 month ago (2014-11-12 08:26:24 UTC) #10
Mike West
Thank you for taking a look at this! One comment right off the top, and ...
6 years, 1 month ago (2014-11-12 12:28:36 UTC) #11
horo
https://codereview.chromium.org/714833002/diff/100001/Source/web/WebEmbeddedWorkerImpl.cpp File Source/web/WebEmbeddedWorkerImpl.cpp (right): https://codereview.chromium.org/714833002/diff/100001/Source/web/WebEmbeddedWorkerImpl.cpp#newcode431 Source/web/WebEmbeddedWorkerImpl.cpp:431: document->contentSecurityPolicy()->deprecatedHeader(), On 2014/11/12 12:28:36, Mike West wrote: > I ...
6 years, 1 month ago (2014-11-13 01:09:02 UTC) #12
Mike West
Oh, man. I completely dropped this CL. I apologize for the delay, that wasn't at ...
6 years, 1 month ago (2014-11-19 10:31:49 UTC) #13
horo
https://codereview.chromium.org/714833002/diff/100001/Source/modules/serviceworkers/FetchManager.cpp File Source/modules/serviceworkers/FetchManager.cpp (right): https://codereview.chromium.org/714833002/diff/100001/Source/modules/serviceworkers/FetchManager.cpp#newcode166 Source/modules/serviceworkers/FetchManager.cpp:166: if (!ContentSecurityPolicy::shouldBypassMainWorld(m_executionContext) && !m_executionContext->contentSecurityPolicy()->allowConnectToSource(m_request->url())) { The old comment was ...
6 years, 1 month ago (2014-11-19 12:35:41 UTC) #14
Mike West
https://codereview.chromium.org/714833002/diff/100001/Source/modules/serviceworkers/FetchManager.cpp File Source/modules/serviceworkers/FetchManager.cpp (right): https://codereview.chromium.org/714833002/diff/100001/Source/modules/serviceworkers/FetchManager.cpp#newcode166 Source/modules/serviceworkers/FetchManager.cpp:166: if (!ContentSecurityPolicy::shouldBypassMainWorld(m_executionContext) && !m_executionContext->contentSecurityPolicy()->allowConnectToSource(m_request->url())) { On 2014/11/19 12:35:41, horo ...
6 years, 1 month ago (2014-11-19 12:40:45 UTC) #15
horo
https://codereview.chromium.org/714833002/diff/100001/Source/modules/serviceworkers/FetchManager.cpp File Source/modules/serviceworkers/FetchManager.cpp (right): https://codereview.chromium.org/714833002/diff/100001/Source/modules/serviceworkers/FetchManager.cpp#newcode166 Source/modules/serviceworkers/FetchManager.cpp:166: if (!ContentSecurityPolicy::shouldBypassMainWorld(m_executionContext) && !m_executionContext->contentSecurityPolicy()->allowConnectToSource(m_request->url())) { > We check in ...
6 years, 1 month ago (2014-11-19 12:57:35 UTC) #16
Mike West
On 2014/11/19 12:57:35, horo wrote: > https://codereview.chromium.org/714833002/diff/100001/Source/modules/serviceworkers/FetchManager.cpp > File Source/modules/serviceworkers/FetchManager.cpp (right): > > https://codereview.chromium.org/714833002/diff/100001/Source/modules/serviceworkers/FetchManager.cpp#newcode166 > ...
6 years, 1 month ago (2014-11-19 13:40:36 UTC) #17
Mike West
Assuming the layout test is added and passes, LGTM. Apologies again for the delayed review.
6 years, 1 month ago (2014-11-19 13:41:00 UTC) #18
horo
On 2014/11/19 13:40:36, Mike West wrote: > On 2014/11/19 12:57:35, horo wrote: > > > ...
6 years, 1 month ago (2014-11-19 14:33:37 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/714833002/140001
6 years, 1 month ago (2014-11-19 21:58:42 UTC) #21
commit-bot: I haz the power
6 years, 1 month ago (2014-11-19 23:15:26 UTC) #22
Message was sent while issue was closed.
Committed patchset #4 (id:140001) as
https://src.chromium.org/viewvc/blink?view=rev&revision=185630

Powered by Google App Engine
This is Rietveld 408576698