Title: [223184] branches/safari-604-branch

Diff

Modified: branches/safari-604-branch/LayoutTests/ChangeLog (223183 => 223184)


--- branches/safari-604-branch/LayoutTests/ChangeLog	2017-10-11 16:09:28 UTC (rev 223183)
+++ branches/safari-604-branch/LayoutTests/ChangeLog	2017-10-11 16:09:31 UTC (rev 223184)
@@ -1,5 +1,21 @@
 2017-10-10  Jason Marcell  <[email protected]>
 
+        Cherry-pick r222788. rdar://problem/34771440
+
+    2017-10-03  Daniel Bates  <[email protected]>
+
+            [CSP] Check policy before opening a new window to a _javascript_ URL
+            https://bugs.webkit.org/show_bug.cgi?id=176815
+            <rdar://problem/34400057>
+
+            Reviewed by Brent Fulgham.
+
+            * http/tests/security/contentSecurityPolicy/resources/window-open-_javascript_-url-blocked.js: Added.
+            * http/tests/security/contentSecurityPolicy/window-open-_javascript_-url-blocked-expected.txt: Added.
+            * http/tests/security/contentSecurityPolicy/window-open-_javascript_-url-blocked.html: Added.
+
+2017-10-10  Jason Marcell  <[email protected]>
+
         Cherry-pick r221831. rdar://problem/34891283
 
     2017-09-08  Dean Jackson  <[email protected]>

Added: branches/safari-604-branch/LayoutTests/http/tests/security/contentSecurityPolicy/resources/window-open-_javascript_-url-blocked.js (0 => 223184)


--- branches/safari-604-branch/LayoutTests/http/tests/security/contentSecurityPolicy/resources/window-open-_javascript_-url-blocked.js	                        (rev 0)
+++ branches/safari-604-branch/LayoutTests/http/tests/security/contentSecurityPolicy/resources/window-open-_javascript_-url-blocked.js	2017-10-11 16:09:31 UTC (rev 223184)
@@ -0,0 +1,7 @@
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.setCanOpenWindows();
+    testRunner.setCloseRemainingWindowsWhenComplete(true);
+}
+
+window.open("_javascript_:alert('FAIL')");

Added: branches/safari-604-branch/LayoutTests/http/tests/security/contentSecurityPolicy/window-open-_javascript_-url-blocked-expected.txt (0 => 223184)


--- branches/safari-604-branch/LayoutTests/http/tests/security/contentSecurityPolicy/window-open-_javascript_-url-blocked-expected.txt	                        (rev 0)
+++ branches/safari-604-branch/LayoutTests/http/tests/security/contentSecurityPolicy/window-open-_javascript_-url-blocked-expected.txt	2017-10-11 16:09:31 UTC (rev 223184)
@@ -0,0 +1,2 @@
+CONSOLE MESSAGE: line 1: Refused to execute a script because its hash, its nonce, or 'unsafe-inline' does not appear in the script-src directive of the Content Security Policy.
+

Added: branches/safari-604-branch/LayoutTests/http/tests/security/contentSecurityPolicy/window-open-_javascript_-url-blocked.html (0 => 223184)


--- branches/safari-604-branch/LayoutTests/http/tests/security/contentSecurityPolicy/window-open-_javascript_-url-blocked.html	                        (rev 0)
+++ branches/safari-604-branch/LayoutTests/http/tests/security/contentSecurityPolicy/window-open-_javascript_-url-blocked.html	2017-10-11 16:09:31 UTC (rev 223184)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="Content-Security-Policy" content="script-src 'self'">
+</head>
+<body>
+<script src=""
+</body>
+</html>

Modified: branches/safari-604-branch/Source/WebCore/ChangeLog (223183 => 223184)


--- branches/safari-604-branch/Source/WebCore/ChangeLog	2017-10-11 16:09:28 UTC (rev 223183)
+++ branches/safari-604-branch/Source/WebCore/ChangeLog	2017-10-11 16:09:31 UTC (rev 223184)
@@ -1,5 +1,25 @@
 2017-10-10  Jason Marcell  <[email protected]>
 
+        Cherry-pick r222788. rdar://problem/34771440
+
+    2017-10-03  Daniel Bates  <[email protected]>
+
+            [CSP] Check policy before opening a new window to a _javascript_ URL
+            https://bugs.webkit.org/show_bug.cgi?id=176815
+            <rdar://problem/34400057>
+
+            Reviewed by Brent Fulgham.
+
+            Ensure that the Content Security Policy of the page allows navigation to a _javascript_ URL
+            before opening a new window to it.
+
+            Test: http/tests/security/contentSecurityPolicy/window-open-_javascript_-url-blocked.html
+
+            * loader/FrameLoader.cpp:
+            (WebCore::createWindow):
+
+2017-10-10  Jason Marcell  <[email protected]>
+
         Cherry-pick r221937. rdar://problem/34893195
 
     2017-09-12  Jer Noble  <[email protected]>

Modified: branches/safari-604-branch/Source/WebCore/loader/FrameLoader.cpp (223183 => 223184)


--- branches/safari-604-branch/Source/WebCore/loader/FrameLoader.cpp	2017-10-11 16:09:28 UTC (rev 223183)
+++ branches/safari-604-branch/Source/WebCore/loader/FrameLoader.cpp	2017-10-11 16:09:31 UTC (rev 223184)
@@ -3713,6 +3713,10 @@
         return nullptr;
     }
 
+    // FIXME: Provide line number information with respect to the opener's document.
+    if (protocolIsJavaScript(request.resourceRequest().url()) && !openerFrame.document()->contentSecurityPolicy()->allowJavaScriptURLs(openerFrame.document()->url(), { }))
+        return nullptr;
+
     // FIXME: Setting the referrer should be the caller's responsibility.
     String referrer = SecurityPolicy::generateReferrerHeader(openerFrame.document()->referrerPolicy(), request.resourceRequest().url(), openerFrame.loader().outgoingReferrer());
     if (!referrer.isEmpty())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to