Title: [256592] releases/WebKitGTK/webkit-2.26
Revision
256592
Author
[email protected]
Date
2020-02-14 01:40:11 -0800 (Fri, 14 Feb 2020)

Log Message

Merge r253563 - Consider top-level context whose origin is unique as insecure
https://bugs.webkit.org/show_bug.cgi?id=205111
Source/WebCore:

Reviewed by Brent Fulgham.

Tests: http/tests/security/top-level-unique-origin.https.html
       http/tests/security/top-level-unique-origin2.https.html

* dom/Document.cpp:
(WebCore::Document::isSecureContext const):
There is no guarantee that top level unique origin contexts like data URL are SecureContext.
This patch makes them no longer SecureContext.
This helps getting closer to https://w3c.github.io/webappsec-secure-contexts/#is-url-trustworthy
which identifies all unique origins as "Not Trustworthy".
Child unique origin contexts will stay SecureContext if their parents are.

Tools:

<rdar://problem/57834967>

Reviewed by Brent Fulgham.

* TestWebKitAPI/Tests/WebKitCocoa/DeviceOrientation.mm:
(TEST):
Disable secure context checks so that loading directly about:blank from the API test
can call DeviceOrientationEvent.requestPermission() successfully.

LayoutTests:

Reviewed by Brent Fulgham.

* http/tests/security/top-level-unique-origin.https-expected.txt: Added.
* http/tests/security/top-level-unique-origin.https.html: Added.
* http/tests/security/top-level-unique-origin2.https-expected.txt: Added.
* http/tests/security/top-level-unique-origin2.https.html: Added.
* platform/win/TestExpectations: Skipping second test as timing out in windows.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.26/LayoutTests/ChangeLog (256591 => 256592)


--- releases/WebKitGTK/webkit-2.26/LayoutTests/ChangeLog	2020-02-14 09:40:01 UTC (rev 256591)
+++ releases/WebKitGTK/webkit-2.26/LayoutTests/ChangeLog	2020-02-14 09:40:11 UTC (rev 256592)
@@ -1,5 +1,18 @@
 2019-12-16  youenn fablet  <[email protected]>
 
+        Consider top-level context whose origin is unique as insecure
+        https://bugs.webkit.org/show_bug.cgi?id=205111
+
+        Reviewed by Brent Fulgham.
+
+        * http/tests/security/top-level-unique-origin.https-expected.txt: Added.
+        * http/tests/security/top-level-unique-origin.https.html: Added.
+        * http/tests/security/top-level-unique-origin2.https-expected.txt: Added.
+        * http/tests/security/top-level-unique-origin2.https.html: Added.
+        * platform/win/TestExpectations: Skipping second test as timing out in windows.
+
+2019-12-16  youenn fablet  <[email protected]>
+
         SecurityOrigin should be unique for null blob URLs that have been unregistered
         https://bugs.webkit.org/show_bug.cgi?id=205169
 

Added: releases/WebKitGTK/webkit-2.26/LayoutTests/http/tests/security/top-level-unique-origin.https-expected.txt (0 => 256592)


--- releases/WebKitGTK/webkit-2.26/LayoutTests/http/tests/security/top-level-unique-origin.https-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.26/LayoutTests/http/tests/security/top-level-unique-origin.https-expected.txt	2020-02-14 09:40:11 UTC (rev 256592)
@@ -0,0 +1 @@
+PASS

Added: releases/WebKitGTK/webkit-2.26/LayoutTests/http/tests/security/top-level-unique-origin.https.html (0 => 256592)


--- releases/WebKitGTK/webkit-2.26/LayoutTests/http/tests/security/top-level-unique-origin.https.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.26/LayoutTests/http/tests/security/top-level-unique-origin.https.html	2020-02-14 09:40:11 UTC (rev 256592)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<script>
+    if (window.testRunner) {
+        testRunner.waitUntilDone();
+        testRunner.dumpAsText();
+    }
+
+    function doTest()
+    {
+        if (window.location.hash === "") {
+            window.location = "data:text/html,<"+ "script>window.location = '" + window.location.href + "#' + window.isSecureContext;<" + "/script>"
+            return;
+        }
+        _onload_ = () => {
+            document.body.innerHTML = window.location.hash === "#false" ? "PASS" : ("FAIL: got " + window.location.hash);
+            if (window.testRunner)
+                testRunner.notifyDone();
+        };
+    }
+    doTest();
+</script>

Added: releases/WebKitGTK/webkit-2.26/LayoutTests/http/tests/security/top-level-unique-origin2.https-expected.txt (0 => 256592)


--- releases/WebKitGTK/webkit-2.26/LayoutTests/http/tests/security/top-level-unique-origin2.https-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.26/LayoutTests/http/tests/security/top-level-unique-origin2.https-expected.txt	2020-02-14 09:40:11 UTC (rev 256592)
@@ -0,0 +1,5 @@
+CONSOLE MESSAGE: line 1: data URL frame loaded
+CONSOLE MESSAGE: line 1: blob popup opened
+CONSOLE MESSAGE: line 1: blob popup loaded
+CONSOLE MESSAGE: line 1: blob popup message posted
+PASS

Added: releases/WebKitGTK/webkit-2.26/LayoutTests/http/tests/security/top-level-unique-origin2.https.html (0 => 256592)


--- releases/WebKitGTK/webkit-2.26/LayoutTests/http/tests/security/top-level-unique-origin2.https.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.26/LayoutTests/http/tests/security/top-level-unique-origin2.https.html	2020-02-14 09:40:11 UTC (rev 256592)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<body>
+<script>
+    if (window.testRunner) {
+        testRunner.waitUntilDone();
+        testRunner.dumpAsText();
+        testRunner.setCanOpenWindows();
+    }
+    _onmessage_ = (event) => {
+        document.body.innerHTML = !event.data ? "PASS": "FAIL";
+        if (window.testRunner)
+            testRunner.notifyDone();
+    };
+    setTimeout(() => {
+        document.body.innerHTML = "TIMEOUT";
+        if (window.testRunner)
+            testRunner.notifyDone();
+    }, 10000);
+</script>
+<iframe src="" URL frame loaded'); const blob = new Blob(['<'+ 'script>console.log(\'blob popup loaded\'); window.opener.postMessage(window.isSecureContext, \'*\'); console.log(\'blob popup message posted\'); <' + '/script>'], {type: 'text/html'}); const popup = window.open(URL.createObjectURL(blob)); _onmessage_ = (event) => { parent.postMessage(event.data, '*'); popup.close(); }; console.log('blob popup opened'); </script>"></iframe>
+</body>

Modified: releases/WebKitGTK/webkit-2.26/LayoutTests/platform/win/TestExpectations (256591 => 256592)


--- releases/WebKitGTK/webkit-2.26/LayoutTests/platform/win/TestExpectations	2020-02-14 09:40:01 UTC (rev 256591)
+++ releases/WebKitGTK/webkit-2.26/LayoutTests/platform/win/TestExpectations	2020-02-14 09:40:11 UTC (rev 256592)
@@ -791,6 +791,8 @@
 # Times out in Release builds
 webkit.org/b/47091 http/tests/misc/copy-resolves-urls.html [ Skip ]
 
+http/tests/security/top-level-unique-origin2.https.html [ Skip ]
+
 # Sometimes fail or timeout
 webkit.org/b/48455 transitions/cancel-transition.html [ Pass Failure ]
 webkit.org/b/48455 legacy-animation-engine/transitions/cancel-transition.html [ Pass Failure ]

Modified: releases/WebKitGTK/webkit-2.26/Source/WebCore/ChangeLog (256591 => 256592)


--- releases/WebKitGTK/webkit-2.26/Source/WebCore/ChangeLog	2020-02-14 09:40:01 UTC (rev 256591)
+++ releases/WebKitGTK/webkit-2.26/Source/WebCore/ChangeLog	2020-02-14 09:40:11 UTC (rev 256592)
@@ -1,5 +1,23 @@
 2019-12-16  youenn fablet  <[email protected]>
 
+        Consider top-level context whose origin is unique as insecure
+        https://bugs.webkit.org/show_bug.cgi?id=205111
+
+        Reviewed by Brent Fulgham.
+
+        Tests: http/tests/security/top-level-unique-origin.https.html
+               http/tests/security/top-level-unique-origin2.https.html
+
+        * dom/Document.cpp:
+        (WebCore::Document::isSecureContext const):
+        There is no guarantee that top level unique origin contexts like data URL are SecureContext.
+        This patch makes them no longer SecureContext.
+        This helps getting closer to https://w3c.github.io/webappsec-secure-contexts/#is-url-trustworthy
+        which identifies all unique origins as "Not Trustworthy".
+        Child unique origin contexts will stay SecureContext if their parents are.
+
+2019-12-16  youenn fablet  <[email protected]>
+
         SecurityOrigin should be unique for null blob URLs that have been unregistered
         https://bugs.webkit.org/show_bug.cgi?id=205169
 

Modified: releases/WebKitGTK/webkit-2.26/Source/WebCore/dom/Document.cpp (256591 => 256592)


--- releases/WebKitGTK/webkit-2.26/Source/WebCore/dom/Document.cpp	2020-02-14 09:40:01 UTC (rev 256591)
+++ releases/WebKitGTK/webkit-2.26/Source/WebCore/dom/Document.cpp	2020-02-14 09:40:11 UTC (rev 256592)
@@ -5941,10 +5941,12 @@
         return true;
     if (!securityOrigin().isPotentiallyTrustworthy())
         return false;
-    for (Frame* frame = m_frame->tree().parent(); frame; frame = frame->tree().parent()) {
+    for (auto* frame = m_frame->tree().parent(); frame; frame = frame->tree().parent()) {
         if (!frame->document()->securityOrigin().isPotentiallyTrustworthy())
             return false;
     }
+    if (topOrigin().isUnique())
+        return false;
     return true;
 }
 

Modified: releases/WebKitGTK/webkit-2.26/Tools/ChangeLog (256591 => 256592)


--- releases/WebKitGTK/webkit-2.26/Tools/ChangeLog	2020-02-14 09:40:01 UTC (rev 256591)
+++ releases/WebKitGTK/webkit-2.26/Tools/ChangeLog	2020-02-14 09:40:11 UTC (rev 256592)
@@ -1,3 +1,16 @@
+2019-12-16  youenn fablet  <[email protected]>
+
+        Consider top-level context whose origin is unique as insecure
+        https://bugs.webkit.org/show_bug.cgi?id=205111
+        <rdar://problem/57834967>
+
+        Reviewed by Brent Fulgham.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/DeviceOrientation.mm:
+        (TEST):
+        Disable secure context checks so that loading directly about:blank from the API test
+        can call DeviceOrientationEvent.requestPermission() successfully.
+
 2019-09-16  Carlos Garcia Campos  <[email protected]>
 
         REGRESSION(r249142): [GTK] Epiphany delayed page loads continue indefinitely

Modified: releases/WebKitGTK/webkit-2.26/Tools/TestWebKitAPI/Tests/WebKitCocoa/DeviceOrientation.mm (256591 => 256592)


--- releases/WebKitGTK/webkit-2.26/Tools/TestWebKitAPI/Tests/WebKitCocoa/DeviceOrientation.mm	2020-02-14 09:40:01 UTC (rev 256591)
+++ releases/WebKitGTK/webkit-2.26/Tools/TestWebKitAPI/Tests/WebKitCocoa/DeviceOrientation.mm	2020-02-14 09:40:11 UTC (rev 256592)
@@ -206,6 +206,9 @@
     configuration.get().websiteDataStore = [WKWebsiteDataStore nonPersistentDataStore];
     [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"testHandler"];
 
+    auto preferences = [configuration preferences];
+    [preferences _setSecureContextChecksEnabled: NO];
+
     webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
     [webView setUIDelegate:uiDelegate.get()];
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to