Title: [295322] branches/safari-613-branch
Revision
295322
Author
[email protected]
Date
2022-06-06 19:30:34 -0700 (Mon, 06 Jun 2022)

Log Message

Cherry-pick e40c1e30bd61. rdar://problem/94467808

    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.

    Canonical link: https://commits.webkit.org/250386@main
    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@293940 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-613-branch/LayoutTests/ChangeLog (295321 => 295322)


--- branches/safari-613-branch/LayoutTests/ChangeLog	2022-06-07 02:30:29 UTC (rev 295321)
+++ branches/safari-613-branch/LayoutTests/ChangeLog	2022-06-07 02:30:34 UTC (rev 295322)
@@ -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-04-27  Youenn Fablet  <[email protected]>
 
         Add testRunner API to clear memory cache

Added: branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-script-src-elem-expected.txt (0 => 295322)


--- branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-script-src-elem-expected.txt	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-script-src-elem-expected.txt	2022-06-07 02:30:34 UTC (rev 295322)
@@ -0,0 +1,2 @@
+ALERT: importScripts allowed
+

Added: branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-script-src-elem.html (0 => 295322)


--- branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-script-src-elem.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/http/tests/security/contentSecurityPolicy/script-src-strict-dynamic-and-script-src-elem.html	2022-06-07 02:30:34 UTC (rev 295322)
@@ -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: branches/safari-613-branch/Source/WebCore/ChangeLog (295321 => 295322)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-06-07 02:30:29 UTC (rev 295321)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-06-07 02:30:34 UTC (rev 295322)
@@ -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-04-27  Youenn Fablet  <[email protected]>
 
         Add testRunner API to clear memory cache

Modified: branches/safari-613-branch/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp (295321 => 295322)


--- branches/safari-613-branch/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp	2022-06-07 02:30:29 UTC (rev 295321)
+++ branches/safari-613-branch/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp	2022-06-07 02:30:34 UTC (rev 295322)
@@ -402,7 +402,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