Title: [279099] trunk
Revision
279099
Author
cdu...@apple.com
Date
2021-06-21 18:24:46 -0700 (Mon, 21 Jun 2021)

Log Message

Adjust `fetch` port blocking for ports 990, 989
https://bugs.webkit.org/show_bug.cgi?id=226971
<rdar://problem/79287147>

Reviewed by Geoffrey Garen.

LayoutTests/imported/w3c:

Re-sync some WPT tests from upstream d41f24fb67a2d65c to gain test coverage from:
- https://github.com/web-platform-tests/wpt/pull/29343

* web-platform-tests/fetch/api/request/request-bad-port.any-expected.txt:
* web-platform-tests/fetch/api/request/request-bad-port.any.js:
* web-platform-tests/fetch/api/request/request-bad-port.any.worker-expected.txt:
* web-platform-tests/tools/wptserve/wptserve/utils.py:
(isomorphic_decode):
(isomorphic_encode):
(is_bad_port):
(http2_compatible):
* web-platform-tests/websockets/Create-blocked-port.any-expected.txt:
* web-platform-tests/websockets/Create-blocked-port.any.js:
* web-platform-tests/websockets/Create-blocked-port.any.worker-expected.txt:
* web-platform-tests/websockets/constants.sub.js: Added.
(url_has_variant):
(else.url_has_flag):
(url_has_flag):
(IsWebSocket):
(CreateWebSocketNonAbsolute):
(CreateWebSocketNonWsScheme):
(CreateWebSocketNonAsciiProtocol):
(CreateWebSocketWithAsciiSep):
(CreateWebSocketWithBlockedPort):
(CreateWebSocketWithSpaceInUrl):
(CreateWebSocketWithSpaceInProtocol):
(CreateWebSocketWithRepeatedProtocols):
(CreateWebSocketWithRepeatedProtocolsCaseInsensitive):
(CreateWebSocket):

Source/WTF:

Prevent connecting to ports 989 & 990 as per:
- https://github.com/whatwg/fetch/pull/1250

* wtf/URL.cpp:
(WTF::portAllowed):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (279098 => 279099)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-06-22 01:22:20 UTC (rev 279098)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-06-22 01:24:46 UTC (rev 279099)
@@ -1,3 +1,41 @@
+2021-06-21  Chris Dumez  <cdu...@apple.com>
+
+        Adjust `fetch` port blocking for ports 990, 989
+        https://bugs.webkit.org/show_bug.cgi?id=226971
+        <rdar://problem/79287147>
+
+        Reviewed by Geoffrey Garen.
+
+        Re-sync some WPT tests from upstream d41f24fb67a2d65c to gain test coverage from:
+        - https://github.com/web-platform-tests/wpt/pull/29343
+
+        * web-platform-tests/fetch/api/request/request-bad-port.any-expected.txt:
+        * web-platform-tests/fetch/api/request/request-bad-port.any.js:
+        * web-platform-tests/fetch/api/request/request-bad-port.any.worker-expected.txt:
+        * web-platform-tests/tools/wptserve/wptserve/utils.py:
+        (isomorphic_decode):
+        (isomorphic_encode):
+        (is_bad_port):
+        (http2_compatible):
+        * web-platform-tests/websockets/Create-blocked-port.any-expected.txt:
+        * web-platform-tests/websockets/Create-blocked-port.any.js:
+        * web-platform-tests/websockets/Create-blocked-port.any.worker-expected.txt:
+        * web-platform-tests/websockets/constants.sub.js: Added.
+        (url_has_variant):
+        (else.url_has_flag):
+        (url_has_flag):
+        (IsWebSocket):
+        (CreateWebSocketNonAbsolute):
+        (CreateWebSocketNonWsScheme):
+        (CreateWebSocketNonAsciiProtocol):
+        (CreateWebSocketWithAsciiSep):
+        (CreateWebSocketWithBlockedPort):
+        (CreateWebSocketWithSpaceInUrl):
+        (CreateWebSocketWithSpaceInProtocol):
+        (CreateWebSocketWithRepeatedProtocols):
+        (CreateWebSocketWithRepeatedProtocolsCaseInsensitive):
+        (CreateWebSocket):
+
 2021-06-21  Rob Buis  <rb...@igalia.com>
 
         CSSOM test for serializing font-variant fails

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-bad-port.any-expected.txt (279098 => 279099)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-bad-port.any-expected.txt	2021-06-22 01:22:20 UTC (rev 279098)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-bad-port.any-expected.txt	2021-06-22 01:24:46 UTC (rev 279099)
@@ -58,12 +58,14 @@
 PASS Request on bad port 587 should throw TypeError.
 PASS Request on bad port 601 should throw TypeError.
 PASS Request on bad port 636 should throw TypeError.
+PASS Request on bad port 989 should throw TypeError.
+PASS Request on bad port 990 should throw TypeError.
 PASS Request on bad port 993 should throw TypeError.
 PASS Request on bad port 995 should throw TypeError.
-PASS Request on bad port 2049 should throw TypeError.
 PASS Request on bad port 1719 should throw TypeError.
 PASS Request on bad port 1720 should throw TypeError.
 PASS Request on bad port 1723 should throw TypeError.
+PASS Request on bad port 2049 should throw TypeError.
 PASS Request on bad port 3659 should throw TypeError.
 PASS Request on bad port 4045 should throw TypeError.
 PASS Request on bad port 5060 should throw TypeError.

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-bad-port.any.js (279098 => 279099)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-bad-port.any.js	2021-06-22 01:22:20 UTC (rev 279098)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-bad-port.any.js	2021-06-22 01:24:46 UTC (rev 279099)
@@ -20,7 +20,7 @@
     42,   // name
     43,   // nicname
     53,   // domain
-    69,   // TFTP
+    69,   // tftp
     77,   // priv-rjs
     79,   // finger
     87,   // ttylink
@@ -38,10 +38,10 @@
     119,  // nntp
     123,  // ntp
     135,  // loc-srv / epmap
-    137,  // netbios
-    139,  // netbios
+    137,  // netbios-ns
+    139,  // netbios-ssn
     143,  // imap2
-    161,  // SNMP
+    161,  // snmp
     179,  // bgp
     389,  // ldap
     427,  // afp (alternate)
@@ -62,18 +62,20 @@
     587,  // smtp (outgoing)
     601,  // syslog-conn
     636,  // ldap+ssl
+    989,  // ftps-data
+    990,  // ftps
     993,  // ldap+ssl
     995,  // pop3+ssl
+    1719, // h323gatestat
+    1720, // h323hostcall
+    1723, // pptp
     2049, // nfs
-    1719, // H323 (RAS)
-    1720, // H323 (Q931)
-    1723, // H323 (H245)
     3659, // apple-sasl
     4045, // lockd
     5060, // sip
     5061, // sips
     6000, // x11
-    6566, // SANE
+    6566, // sane-port
     6665, // irc (alternate)
     6666, // irc (alternate)
     6667, // irc (default)

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-bad-port.any.worker-expected.txt (279098 => 279099)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-bad-port.any.worker-expected.txt	2021-06-22 01:22:20 UTC (rev 279098)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-bad-port.any.worker-expected.txt	2021-06-22 01:24:46 UTC (rev 279099)
@@ -58,12 +58,14 @@
 PASS Request on bad port 587 should throw TypeError.
 PASS Request on bad port 601 should throw TypeError.
 PASS Request on bad port 636 should throw TypeError.
+PASS Request on bad port 989 should throw TypeError.
+PASS Request on bad port 990 should throw TypeError.
 PASS Request on bad port 993 should throw TypeError.
 PASS Request on bad port 995 should throw TypeError.
-PASS Request on bad port 2049 should throw TypeError.
 PASS Request on bad port 1719 should throw TypeError.
 PASS Request on bad port 1720 should throw TypeError.
 PASS Request on bad port 1723 should throw TypeError.
+PASS Request on bad port 2049 should throw TypeError.
 PASS Request on bad port 3659 should throw TypeError.
 PASS Request on bad port 4045 should throw TypeError.
 PASS Request on bad port 5060 should throw TypeError.

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/tools/wptserve/wptserve/utils.py (279098 => 279099)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/tools/wptserve/wptserve/utils.py	2021-06-22 01:22:20 UTC (rev 279098)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/tools/wptserve/wptserve/utils.py	2021-06-22 01:24:46 UTC (rev 279099)
@@ -125,6 +125,8 @@
         587,   # smtp (outgoing)
         601,   # syslog-conn
         636,   # ldap+ssl
+        989,   # ftps-data
+        999,   # ftps
         993,   # ldap+ssl
         995,   # pop3+ssl
         2049,  # nfs

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/websockets/Create-blocked-port.any-expected.txt (279098 => 279099)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/websockets/Create-blocked-port.any-expected.txt	2021-06-22 01:22:20 UTC (rev 279098)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/websockets/Create-blocked-port.any-expected.txt	2021-06-22 01:24:46 UTC (rev 279099)
@@ -38,7 +38,6 @@
 PASS WebSocket blocked port test 137
 PASS WebSocket blocked port test 139
 PASS WebSocket blocked port test 143
-PASS WebSocket blocked port test 161
 PASS WebSocket blocked port test 179
 PASS WebSocket blocked port test 389
 PASS WebSocket blocked port test 427
@@ -59,16 +58,16 @@
 PASS WebSocket blocked port test 587
 PASS WebSocket blocked port test 601
 PASS WebSocket blocked port test 636
+PASS WebSocket blocked port test 989
+PASS WebSocket blocked port test 990
 PASS WebSocket blocked port test 993
 PASS WebSocket blocked port test 995
-PASS WebSocket blocked port test 2049
 PASS WebSocket blocked port test 1719
 PASS WebSocket blocked port test 1720
 PASS WebSocket blocked port test 1723
+PASS WebSocket blocked port test 2049
 PASS WebSocket blocked port test 3659
 PASS WebSocket blocked port test 4045
-PASS WebSocket blocked port test 5060
-PASS WebSocket blocked port test 5061
 PASS WebSocket blocked port test 6000
 PASS WebSocket blocked port test 6566
 PASS WebSocket blocked port test 6665

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/websockets/Create-blocked-port.any.js (279098 => 279099)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/websockets/Create-blocked-port.any.js	2021-06-22 01:22:20 UTC (rev 279098)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/websockets/Create-blocked-port.any.js	2021-06-22 01:24:46 UTC (rev 279099)
@@ -1,4 +1,7 @@
-// META: script=websocket.sub.js
+// META: script=constants.sub.js
+// META: variant=
+// META: variant=?wss
+// META: variant=?wpt_flags=h2
 
 async_test(t => {
   const ws = CreateWebSocketWithBlockedPort(__PORT)
@@ -25,7 +28,7 @@
   42,   // name
   43,   // nicname
   53,   // domain
-  69,   // TFTP
+  69,   // tftp
   77,   // priv-rjs
   79,   // finger
   87,   // ttylink
@@ -43,10 +46,9 @@
   119,  // nntp
   123,  // ntp
   135,  // loc-srv / epmap
-  137,  // netbios
-  139,  // netbios
+  137,  // netbios-ns
+  139,  // netbios-ssn
   143,  // imap2
-  161,  // SNMP
   179,  // bgp
   389,  // ldap
   427,  // afp (alternate)
@@ -67,18 +69,18 @@
   587,  // smtp (outgoing)
   601,  // syslog-conn
   636,  // ldap+ssl
+  989,  // ftps-data
+  990,  // ftps
   993,  // ldap+ssl
   995,  // pop3+ssl
+  1719, // h323gatestat
+  1720, // h323hostcall
+  1723, // pptp
   2049, // nfs
-  1719, // H323 (RAS)
-  1720, // H323 (Q931)
-  1723, // H323 (H245)
   3659, // apple-sasl
   4045, // lockd
-  5060, // sip
-  5061, // sips
   6000, // x11
-  6566, // SANE
+  6566, // sane-port
   6665, // irc (alternate)
   6666, // irc (alternate)
   6667, // irc (default)

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/websockets/Create-blocked-port.any.worker-expected.txt (279098 => 279099)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/websockets/Create-blocked-port.any.worker-expected.txt	2021-06-22 01:22:20 UTC (rev 279098)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/websockets/Create-blocked-port.any.worker-expected.txt	2021-06-22 01:24:46 UTC (rev 279099)
@@ -38,7 +38,6 @@
 PASS WebSocket blocked port test 137
 PASS WebSocket blocked port test 139
 PASS WebSocket blocked port test 143
-PASS WebSocket blocked port test 161
 PASS WebSocket blocked port test 179
 PASS WebSocket blocked port test 389
 PASS WebSocket blocked port test 427
@@ -59,16 +58,16 @@
 PASS WebSocket blocked port test 587
 PASS WebSocket blocked port test 601
 PASS WebSocket blocked port test 636
+PASS WebSocket blocked port test 989
+PASS WebSocket blocked port test 990
 PASS WebSocket blocked port test 993
 PASS WebSocket blocked port test 995
-PASS WebSocket blocked port test 2049
 PASS WebSocket blocked port test 1719
 PASS WebSocket blocked port test 1720
 PASS WebSocket blocked port test 1723
+PASS WebSocket blocked port test 2049
 PASS WebSocket blocked port test 3659
 PASS WebSocket blocked port test 4045
-PASS WebSocket blocked port test 5060
-PASS WebSocket blocked port test 5061
 PASS WebSocket blocked port test 6000
 PASS WebSocket blocked port test 6566
 PASS WebSocket blocked port test 6665

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/websockets/constants.sub.js (0 => 279099)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/websockets/constants.sub.js	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/websockets/constants.sub.js	2021-06-22 01:24:46 UTC (rev 279099)
@@ -0,0 +1,100 @@
+const __SERVER__NAME = "{{host}}";
+const __PATH = "echo";
+
+var __SCHEME;
+var __PORT;
+if (url_has_variant('wss')) {
+  __SCHEME = 'wss';
+  __PORT = "{{ports[wss][0]}}";
+} else if (url_has_flag('h2')) {
+  __SCHEME = 'wss';
+  __PORT = "{{ports[h2][0]}}";
+} else {
+  __SCHEME = 'ws';
+  __PORT = "{{ports[ws][0]}}";
+}
+
+const SCHEME_DOMAIN_PORT = __SCHEME + '://' + __SERVER__NAME + ':' + __PORT;
+
+function url_has_variant(variant) {
+  const params = new URLSearchParams(location.search);
+  return params.get(variant) === "";
+}
+
+function url_has_flag(flag) {
+  const params = new URLSearchParams(location.search);
+  return params.getAll("wpt_flags").indexOf(flag) !== -1;
+}
+
+function IsWebSocket() {
+  if (!self.WebSocket) {
+    assert_true(false, "Browser does not support WebSocket");
+  }
+}
+
+function CreateWebSocketNonAbsolute() {
+  IsWebSocket();
+  const url = ""
+  return new WebSocket(url);
+}
+
+function CreateWebSocketNonWsScheme() {
+  IsWebSocket();
+  const url = "" + __SERVER__NAME + ":" + __PORT + "/" + __PATH;
+  return new WebSocket(url);
+}
+
+function CreateWebSocketNonAsciiProtocol(nonAsciiProtocol) {
+  IsWebSocket();
+  const url = "" + "/" + __PATH;
+  return new WebSocket(url, nonAsciiProtocol);
+}
+
+function CreateWebSocketWithAsciiSep(asciiWithSep) {
+  IsWebSocket();
+  const url = "" + "/" + __PATH;
+  return new WebSocket(url, asciiWithSep);
+}
+
+function CreateWebSocketWithBlockedPort(blockedPort) {
+  IsWebSocket();
+  const url = "" + "://" + __SERVER__NAME + ":" + blockedPort + "/" + __PATH;
+  return new WebSocket(url);
+}
+
+function CreateWebSocketWithSpaceInUrl(urlWithSpace) {
+  IsWebSocket();
+  const url = "" + "://" + urlWithSpace + ":" + __PORT + "/" + __PATH;
+  return new WebSocket(url);
+}
+
+function CreateWebSocketWithSpaceInProtocol(protocolWithSpace) {
+  IsWebSocket();
+  const url = "" + "/" + __PATH;
+  return new WebSocket(url, protocolWithSpace);
+}
+
+function CreateWebSocketWithRepeatedProtocols() {
+  IsWebSocket();
+  const url = "" + "/" + __PATH;
+  return new WebSocket(url, ["echo", "echo"]);
+}
+
+function CreateWebSocketWithRepeatedProtocolsCaseInsensitive() {
+  IsWebSocket();
+  const url = "" + "/" + __PATH;
+  wsocket = new WebSocket(url, ["echo", "eCho"]);
+}
+
+function CreateWebSocket(isProtocol, isProtocols) {
+  IsWebSocket();
+  const url = "" + "/" + __PATH;
+
+  if (isProtocol) {
+    return new WebSocket(url, "echo");
+  }
+  if (isProtocols) {
+    return new WebSocket(url, ["echo", "chat"]);
+  }
+  return new WebSocket(url);
+}

Modified: trunk/Source/WTF/ChangeLog (279098 => 279099)


--- trunk/Source/WTF/ChangeLog	2021-06-22 01:22:20 UTC (rev 279098)
+++ trunk/Source/WTF/ChangeLog	2021-06-22 01:24:46 UTC (rev 279099)
@@ -1,3 +1,17 @@
+2021-06-21  Chris Dumez  <cdu...@apple.com>
+
+        Adjust `fetch` port blocking for ports 990, 989
+        https://bugs.webkit.org/show_bug.cgi?id=226971
+        <rdar://problem/79287147>
+
+        Reviewed by Geoffrey Garen.
+
+        Prevent connecting to ports 989 & 990 as per:
+        - https://github.com/whatwg/fetch/pull/1250
+
+        * wtf/URL.cpp:
+        (WTF::portAllowed):
+
 2021-06-21  Fujii Hironori  <hironori.fu...@sony.com>
 
         [WinCairo] Turn ENABLE_SHAREABLE_RESOURCE on

Modified: trunk/Source/WTF/wtf/URL.cpp (279098 => 279099)


--- trunk/Source/WTF/wtf/URL.cpp	2021-06-22 01:22:20 UTC (rev 279098)
+++ trunk/Source/WTF/wtf/URL.cpp	2021-06-22 01:24:46 UTC (rev 279099)
@@ -957,6 +957,8 @@
         587,  // ESMTP
         601,  // syslog-conn
         636,  // LDAP+SSL
+        989,  // ftps-data
+        990,  // ftps
         993,  // IMAP+SSL
         995,  // POP3+SSL
         1719, // H323 (RAS)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to