Skip to content
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

HTTPS pages should redirect IPFS subresources of a page to IPFS gateway #37534

Closed
kdenhartog opened this issue Apr 12, 2024 · 6 comments
Closed

Comments

@kdenhartog
Copy link
Member

kdenhartog commented Apr 12, 2024

We should automatically convert IPFS subresources being loaded in an HTTPS top level frame to a public gateway URL that relies upon HTTPS as well rather than block them. If the top level frame uses an IPFS scheme then the current method of loading it via the local node should be used instead.

@kdenhartog kdenhartog changed the title [HackerOne]: Redirect IPFS subresources in certain conditions HTTPS pages should redirect subresources of a page to IPFS gateway Apr 12, 2024
@kdenhartog kdenhartog changed the title HTTPS pages should redirect subresources of a page to IPFS gateway HTTPS pages should redirect IPFS subresources of a page to IPFS gateway Apr 12, 2024
@diracdeltas
Copy link
Member

Noting that unless something regressed after #12546, IPFS resources loaded on HTTP(s) are already being blocked.

@kdenhartog
Copy link
Member Author

I just double checked this and that's correct if the top level frame uses HTTPS scheme. If the top level frame is an IPFS scheme than the IPFS resource will be rendered still. I'll update the text here to be a bit more specific about this issue.

@kdenhartog
Copy link
Member Author

Here's a good diagram to visualize how this should work from @vadimstruts shared in slack

image

@lidel
Copy link

lidel commented Apr 15, 2024

Brave already has logic for detecting top-level IPFS resources based on the HTTPS URL in the address bar (path, subdomain, or dnslink gateways described here).

All these https:// variants are effectively the "Gateway" arrow in the above diagram.

Today, Brave detects and displays the badge on such pages:

2024-04-15-163725_157x61_scrot

I think @vadimstruts's diagram is ok, it shows how Brave can fix IPFS websites loaded via public HTTP gateways.

Loading ipfs:// URLs of subresources via public HTTP gateway the user has opted into respects user's choice, and probably the easiest to implement.

An alternative, more decentralized version (for path and subdomain URLs) is to use the same origin as path or subdomain gateway user currently is, so if user has preference to use https://dweb.link as their public gateway, and they are on cid.ipfs.cf-ipfs.com and they load ipfs://bafoo1 it could attempt fetch from https://cf-ipfs.com/ipfs/bafoo1 first (same gateway as parent page) instead of https://dweb.link/ipfs/bafoo1, and retry with dweb.link (cross-gateway fetch) only if the original gateway fails. This way, user would not leak subresource requests across different gateways. I guess this could also be a toggle option in settings, as users may prefer one way or another?

@kdenhartog
Copy link
Member Author

image

Here's an updated diagram as well since @diracdeltas caught a problem when discussing further on slack.

@diracdeltas
Copy link
Member

This is deprecated by #37735 since we won't support ipfs schemes anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants