Bug 153157 - CSP: Use the served CSP header for dedicated workers
Summary: CSP: Use the served CSP header for dedicated workers
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Local Build
Hardware: All All
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords: BlinkMergeCandidate, InRadar
Depends on:
Blocks: 153562 153612 153622
  Show dependency treegraph
 
Reported: 2016-01-15 15:07 PST by Daniel Bates
Modified: 2016-01-31 19:10 PST (History)
9 users (show)

See Also:


Attachments
Patch and Layout Test (60.27 KB, patch)
2016-01-28 09:03 PST, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch and Layout Test (63.19 KB, patch)
2016-01-28 09:37 PST, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch and Layout Tests (69.90 KB, patch)
2016-01-28 10:54 PST, Daniel Bates
bfulgham: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2016-01-15 15:07:34 PST
We should merge <https://src.chromium.org/viewvc/blink?view=rev&revision=194094> and <https://src.chromium.org/viewvc/blink?view=rev&revision=194143> (in order).

Use the served CSP header for dedicated workers

This CL makes workers obey the CSP that was served as a header along
with the worker script, instead of inheriting the CSP from the document
that spawned the worker. (Blob and file URLs still inherit the CSP from
the parent document.)
Comment 1 Radar WebKit Bug Importer 2016-01-27 20:44:32 PST
<rdar://problem/24383254>
Comment 2 Daniel Bates 2016-01-28 09:03:56 PST
Created attachment 270118 [details]
Patch and Layout Test
Comment 3 WebKit Commit Bot 2016-01-28 09:05:58 PST
Attachment 270118 [details] did not pass style-queue:


ERROR: Source/WebCore/workers/DedicatedWorkerThread.h:37:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebCore/workers/WorkerGlobalScopeProxy.h:41:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebCore/workers/WorkerMessagingProxy.h:43:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebCore/workers/DedicatedWorkerGlobalScope.h:39:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebCore/workers/WorkerThread.h:38:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
Total errors found: 5 in 26 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Daniel Bates 2016-01-28 09:37:58 PST
Created attachment 270120 [details]
Patch and Layout Test

Add files ContentSecurityPolicyResponseHeaders.{cpp, h} to the CMake build system and Visual Studio project file
Comment 5 WebKit Commit Bot 2016-01-28 09:46:37 PST
Attachment 270120 [details] did not pass style-queue:


ERROR: Source/WebCore/workers/DedicatedWorkerThread.h:37:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebCore/workers/WorkerGlobalScopeProxy.h:41:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebCore/workers/WorkerMessagingProxy.h:43:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebCore/workers/DedicatedWorkerGlobalScope.h:39:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebCore/workers/WorkerThread.h:38:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
Total errors found: 5 in 29 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Daniel Bates 2016-01-28 10:54:35 PST
Created attachment 270127 [details]
Patch and Layout Tests

Updated patch to inherit CSP from owner document of worker when script URL of worker is a file URL as per comment #0. Added tests LayoutTests/fast/workers/worker-inherits-csp-blocks-{eval, xhr}.html to ensure we do not regress this behavior.
Comment 7 WebKit Commit Bot 2016-01-28 10:57:26 PST
Attachment 270127 [details] did not pass style-queue:


ERROR: Source/WebCore/workers/DedicatedWorkerThread.h:37:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebCore/workers/WorkerGlobalScopeProxy.h:41:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebCore/workers/WorkerMessagingProxy.h:43:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebCore/workers/DedicatedWorkerGlobalScope.h:39:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
ERROR: Source/WebCore/workers/WorkerThread.h:38:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
Total errors found: 5 in 35 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 8 Brent Fulgham 2016-01-28 18:51:58 PST
Comment on attachment 270127 [details]
Patch and Layout Tests

View in context: https://bugs.webkit.org/attachment.cgi?id=270127&action=review

r=me. I don't know why the patch will not apply on the WK2 bot, but presumably its a machine-specific issue. Please watch test results carefully after landing.

> Source/WebCore/ChangeLog:58
> +        (WebCore::ContentSecurityPolicyResponseHeaders::isolatedCopy): Make an copy of this object that is

Make *a* copy! :-)
Comment 9 Daniel Bates 2016-01-31 19:10:06 PST
Committed r195948: <http://trac.webkit.org/changeset/195948>