ipfs / ipfs-desktop

An unobtrusive and user-friendly desktop application for IPFS on Windows, Mac and Linux.
https://docs.ipfs.tech/install/ipfs-desktop/
MIT License
5.86k stars 850 forks source link

Share Link incorrectly gives path routed instead of subdomain routed URL. #2740

Open MicahZoltu opened 5 months ago

MicahZoltu commented 5 months ago

Describe the bug When you right click on a file in Files and choose "Share Link" you are given a URL like https://<host>/ipfs/<cid>. This should be of the form https://<cid>.ipfs.<host> for security reasons.

To Reproduce Steps to reproduce the behavior:

  1. Go to Files tab.
  2. Right click on any file.
  3. Choose "Share Link"
  4. Notice the link provided uses path routing.

Expected behavior Subdomain routing is always used.

Additional context Path routing is known to be insecure for websites that use cookies, local storage, etc. This is well documented in the IPFS documentation and the documentation and security experts all recommend using subdomain routing whenever possible (which is almost always possible). These share links are encouraging people to share URLs that are insecure by default, and we should instead be using subdomain by default.

whizzzkid commented 5 months ago

Thanks @milahu this sounds like a good feature to have, the reason it doesn't have it today is because not all gateways support subdomain gateways. The default gateway does, but that's not the norm. I think we can implement a simple check to validate if the server supports subdomain gatways and then generate those links.

I'll mark this as a backlog item.