Title: [293940] trunk
Revision
293940
Author
[email protected]
Date
2022-05-06 18:38:09 -0700 (Fri, 06 May 2022)

Log Message

CSP: Fix script-src-elem policies in workers
https://bugs.webkit.org/show_bug.cgi?id=239840

Reviewed by Kate Cheney.

Source/WebCore:

Test: http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-script-src-elem.html

* page/csp/ContentSecurityPolicyDirectiveList.cpp:
(WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForScript const):

LayoutTests:

CSP: Fix script-src-elem policies in workers

* http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-script-src-elem-expected.txt: Added.
* http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-script-src-elem.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (293939 => 293940)


--- trunk/LayoutTests/ChangeLog	2022-05-07 01:32:26 UTC (rev 293939)
+++ trunk/LayoutTests/ChangeLog	2022-05-07 01:38:09 UTC (rev 293940)
@@ -1,3 +1,15 @@
+2022-05-06  Patrick Griffis  <[email protected]>
+
+        CSP: Fix script-src-elem policies in workers
+        https://bugs.webkit.org/show_bug.cgi?id=239840
+
+        Reviewed by Kate Cheney.
+
+        CSP: Fix script-src-elem policies in workers
+
+        * http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-script-src-elem-expected.txt: Added.
+        * http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-script-src-elem.html: Added.
+
 2022-05-06  Karl Rackler  <[email protected]>
 
         [Gardening] REGRESSION (r293117): [ iOS ] fast/innerHTML/001.html is a flaky image failure

Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-script-src-elem-expected.txt (0 => 293940)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-script-src-elem-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-script-src-elem-expected.txt	2022-05-07 01:38:09 UTC (rev 293940)
@@ -0,0 +1,2 @@
+ALERT: importScripts allowed
+

Added: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-script-src-elem.html (0 => 293940)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-script-src-elem.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-script-src-elem.html	2022-05-07 01:38:09 UTC (rev 293940)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+</script>
+</head>
+<body>
+<script>
+try {
+    var worker = new Worker('http://127.0.0.1:8000/security/contentSecurityPolicy/resources/worker.py?type=importscripts&csp=' +
+                            encodeURIComponent("script-src 'strict-dynamic'; script-src-elem localhost:8000"));
+    worker._onmessage_ = function (event) {
+        alert(event.data);
+        if (window.testRunner)
+            testRunner.notifyDone();
+    };
+} catch (e) {
+    alert(e);
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (293939 => 293940)


--- trunk/Source/WebCore/ChangeLog	2022-05-07 01:32:26 UTC (rev 293939)
+++ trunk/Source/WebCore/ChangeLog	2022-05-07 01:38:09 UTC (rev 293940)
@@ -1,3 +1,15 @@
+2022-05-06  Patrick Griffis  <[email protected]>
+
+        CSP: Fix script-src-elem policies in workers
+        https://bugs.webkit.org/show_bug.cgi?id=239840
+
+        Reviewed by Kate Cheney.
+
+        Test: http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-script-src-elem.html
+
+        * page/csp/ContentSecurityPolicyDirectiveList.cpp:
+        (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForScript const):
+
 2022-05-06  Tim Nguyen  <[email protected]>
 
         Use dynamicDowncast in getPathFromPathOperation()

Modified: trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp (293939 => 293940)


--- trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp	2022-05-07 01:32:26 UTC (rev 293939)
+++ trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp	2022-05-07 01:38:09 UTC (rev 293940)
@@ -408,7 +408,7 @@
 
 const ContentSecurityPolicyDirective* ContentSecurityPolicyDirectiveList::violatedDirectiveForScript(const URL& url, bool didReceiveRedirectResponse, const Vector<ResourceCryptographicDigest>& subResourceIntegrityDigests, const String& nonce) const
 {
-    auto* operativeDirective = this->operativeDirective(m_scriptSrc.get(), ContentSecurityPolicyDirectiveNames::scriptSrcElem);
+    auto* operativeDirective = this->operativeDirectiveScript(m_scriptSrcElem.get(), ContentSecurityPolicyDirectiveNames::scriptSrcElem);
 
     if (!operativeDirective
         || operativeDirective->containsAllHashes(subResourceIntegrityDigests)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to