Closed Bug 1684620 Opened 4 years ago Closed 4 years ago

Trying to connect to a forbidden port with websocket no longer returns SECURITY_ERR

Categories

(Core :: Networking: WebSockets, defect)

Firefox 84
defect

Tracking

()

RESOLVED DUPLICATE of bug 1349969

People

(Reporter: najamelan, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

Steps to reproduce:

new WebSocket( "wss://najamelan.github.io:6000" );

I am author of a Rust library that exposes a Rust API to use websockets on wasm.

Recently a test started failing because a forbidden port is no longer distinguishable from a server that doesn't listen on a certain port.

This seems like it doesn't respect the standard anymore as well as creates an inconsistency with how chrome reports the error.

I wonder if this change was intended and if so what the motivation was.

I first noticed the issue on Firefox 84 on Linux but other versions may be affected.

Actual results:

WebSocket { url: "wss://najamelan.github.io:6000/", readyState: 0, bufferedAmount: 0, onopen: null, onerror: null, onclose: null, extensions: "", protocol: "", onmessage: null, binaryType: "blob" }
Firefox can’t establish a connection to the server at wss://najamelan.github.io:6000/.
Firefox can’t establish a connection to the server at wss://najamelan.github.io:6000/.

Expected results:

Websocket standard (https://www.w3.org/TR/websockets/)

point 4.3: If port is a port to which the user agent is configured to block access, then throw a SecurityError exception. (User agents typically block access to well-known ports like SMTP.)

On chrome for example the console will say:

Uncaught DOMException: Failed to construct 'WebSocket': The port 6000 is not allowed.
at <anonymous>:1:1

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Networking: WebSockets
Product: Firefox → Core

This was intentional change that all browsers will implement. See bug 1349969 and https://github.com/web-platform-tests/wpt/pull/26392.

Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.