Diff
Modified: branches/safari-608-branch/LayoutTests/ChangeLog (253712 => 253713)
--- branches/safari-608-branch/LayoutTests/ChangeLog 2019-12-18 21:43:50 UTC (rev 253712)
+++ branches/safari-608-branch/LayoutTests/ChangeLog 2019-12-18 21:43:56 UTC (rev 253713)
@@ -1,5 +1,63 @@
2019-12-18 Dan Robson <[email protected]>
+ Cherry-pick r253563. rdar://problem/58049160
+
+ 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.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253563 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 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-18 Dan Robson <[email protected]>
+
Cherry-pick r253544. rdar://problem/58049164
SecurityOrigin should be unique for null blob URLs that have been unregistered
Added: branches/safari-608-branch/LayoutTests/http/tests/security/top-level-unique-origin.https-expected.txt (0 => 253713)
--- branches/safari-608-branch/LayoutTests/http/tests/security/top-level-unique-origin.https-expected.txt (rev 0)
+++ branches/safari-608-branch/LayoutTests/http/tests/security/top-level-unique-origin.https-expected.txt 2019-12-18 21:43:56 UTC (rev 253713)
@@ -0,0 +1 @@
+PASS
Added: branches/safari-608-branch/LayoutTests/http/tests/security/top-level-unique-origin.https.html (0 => 253713)
--- branches/safari-608-branch/LayoutTests/http/tests/security/top-level-unique-origin.https.html (rev 0)
+++ branches/safari-608-branch/LayoutTests/http/tests/security/top-level-unique-origin.https.html 2019-12-18 21:43:56 UTC (rev 253713)
@@ -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: branches/safari-608-branch/LayoutTests/http/tests/security/top-level-unique-origin2.https-expected.txt (0 => 253713)
--- branches/safari-608-branch/LayoutTests/http/tests/security/top-level-unique-origin2.https-expected.txt (rev 0)
+++ branches/safari-608-branch/LayoutTests/http/tests/security/top-level-unique-origin2.https-expected.txt 2019-12-18 21:43:56 UTC (rev 253713)
@@ -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: branches/safari-608-branch/LayoutTests/http/tests/security/top-level-unique-origin2.https.html (0 => 253713)
--- branches/safari-608-branch/LayoutTests/http/tests/security/top-level-unique-origin2.https.html (rev 0)
+++ branches/safari-608-branch/LayoutTests/http/tests/security/top-level-unique-origin2.https.html 2019-12-18 21:43:56 UTC (rev 253713)
@@ -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: branches/safari-608-branch/LayoutTests/platform/win/TestExpectations (253712 => 253713)
--- branches/safari-608-branch/LayoutTests/platform/win/TestExpectations 2019-12-18 21:43:50 UTC (rev 253712)
+++ branches/safari-608-branch/LayoutTests/platform/win/TestExpectations 2019-12-18 21:43:56 UTC (rev 253713)
@@ -789,6 +789,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: branches/safari-608-branch/Source/WebCore/ChangeLog (253712 => 253713)
--- branches/safari-608-branch/Source/WebCore/ChangeLog 2019-12-18 21:43:50 UTC (rev 253712)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog 2019-12-18 21:43:56 UTC (rev 253713)
@@ -1,5 +1,68 @@
2019-12-18 Dan Robson <[email protected]>
+ Cherry-pick r253563. rdar://problem/58049160
+
+ 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.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253563 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 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-18 Dan Robson <[email protected]>
+
Cherry-pick r253544. rdar://problem/58049164
SecurityOrigin should be unique for null blob URLs that have been unregistered
Modified: branches/safari-608-branch/Source/WebCore/dom/Document.cpp (253712 => 253713)
--- branches/safari-608-branch/Source/WebCore/dom/Document.cpp 2019-12-18 21:43:50 UTC (rev 253712)
+++ branches/safari-608-branch/Source/WebCore/dom/Document.cpp 2019-12-18 21:43:56 UTC (rev 253713)
@@ -5917,10 +5917,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: branches/safari-608-branch/Tools/ChangeLog (253712 => 253713)
--- branches/safari-608-branch/Tools/ChangeLog 2019-12-18 21:43:50 UTC (rev 253712)
+++ branches/safari-608-branch/Tools/ChangeLog 2019-12-18 21:43:56 UTC (rev 253713)
@@ -1,3 +1,61 @@
+2019-12-18 Dan Robson <[email protected]>
+
+ Cherry-pick r253563. rdar://problem/58049160
+
+ 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.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253563 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 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-12-04 Alan Coon <[email protected]>
Cherry-pick r252050. rdar://problem/56900657
Modified: branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/DeviceOrientation.mm (253712 => 253713)
--- branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/DeviceOrientation.mm 2019-12-18 21:43:50 UTC (rev 253712)
+++ branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/DeviceOrientation.mm 2019-12-18 21:43:56 UTC (rev 253713)
@@ -204,6 +204,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()];