ipfs / helia

An implementation of IPFS in JavaScript
https://helia.io
Other
811 stars 81 forks source link

`allowInsecure: false` should respect Secure Contexts #564

Open lidel opened 1 week ago

lidel commented 1 week ago

Problem

Setting allowInsecure: false should not be blindly blocking http://, it should not block requests to http://localhost and http://*.localhost because these are valid Secure Contexts.

This bug blocks users from using their own local gateway (ipfs desktop, kubo, rainbow).

Solution

Correctly recognize http://localhost[:port] and http://*.localhost[:port] as secure contexts.

[!IMPORTANT] Only localhost label is marked as Secure Context, URLs with loopback 127.0.0.1 IPs are not.

Ref.