-
Notifications
You must be signed in to change notification settings - Fork 445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No way to restrict to only WSS and exclude WS #796
Comments
Hello @georgyo Due to browser’s security policies you couldn’t establish unencrypted connection from secure context (e.g. page loaded via HTTPS). You can read about it at MDN Secure Context. There is a lot of work regarding the DHT in the browser that we need to land. We will also be working on Connection Gating which can help us not attempting to connect to such nodes in the browser. This work will be part of the upcoming Connection manager overhaul #744 |
I think the general issue here is that the websocket filter function is too lenient, https://github.com/libp2p/js-libp2p-websockets/blob/v0.14.0/src/index.js#L127-L129. Right now it allows TCP and DNS addresses, and allows them to be ws or wss. Outside of development we should really be restricting to DNS only. It is possible we could connect to a local TCP loopback peer, but this isn't likely to be a common use case. Right now @vasco-santos this ties in a bit to the dial address filtering work you've been doing, but we should also look at restricting websocket filtering more. We may want to look at making the filter configurable, because if we get too strict that could get really annoying for certain environments. |
I'm trying on 0.0.0.0 and getting the following (self-signed)
I guess it just defaults to ws at any rate, as JH mentions above This is true even if I specify the address Perhaps unrelated: if I visit an IP address other than localhost on a parcel server, it gives me "Error: Missing Web Crypto API" and fails to load as well. |
This is now fixed with |
Type: Enhancement
Severity: Medium
Description:
When using IPFS with dht enabled from a address that is not local host, the browser makes it impossible to open connections to not TLS websockets.
As a result, you end up with thousands of failed attempts to contact hosts the browser will reject, flooding the console.
The transports section of js-libp2p takes a module of https://github.com/libp2p/js-libp2p-websockets, which is maybe where this bug report should have ended up.
There also seems to be a heavy performance penalty as throughput plummets, even when directly attached to nodes that have the content. Though I need to debug this further.
Steps to reproduce the error:
Spawn an IPFS node with at least the following config and try visiting it from a website using TLS:
This is easily seen here: https://bafybeihxe5lmiyonwlh4yxb7o5wthq7lwrd366orvj5urmcuhfmrlc65ca.ipfs.dweb.link/
The text was updated successfully, but these errors were encountered: