ipfs / ipfs-companion

Browser extension that simplifies access to IPFS resources on the web
https://docs.ipfs.tech/install/ipfs-companion/
Creative Commons Zero v1.0 Universal
2.05k stars 325 forks source link

github.com/ipfs/kubo/* isn't clickable #1249

Closed bradcarnage closed 1 year ago

bradcarnage commented 1 year ago

Describe the bug when you search for documentation, and try to click on a github.com/ipfs/kubo/* link, IPFS companion or brave tries to redirect to an IPFS resolver, when in reality it should just load content from github.

To Reproduce Steps to reproduce the behavior:

  1. Go to duckduckgo.com
  2. Search for "ipfs kubo github"
  3. Click on ipfs/kubo.
  4. See error about invalid CID

Expected behavior Redirect to original URL when CID invalid, or give the user the option to stop redirecting this domain upon encountering an error

Screenshots image1 image2

Desktop Information:

Additional context This was a really cool bug when trying to look up documentation and error reports for IPFS kubo :)

This "bugfix" should really just be a policy re-write on how the browser chooses to redirect sites or show error messages. Ideally IPFS companion or the browser would show the resolution error, and give the user an option to "go to original URL and never redirect /ipfs/ links from this domain again"

Possibly, the browser would simply redirect back to the original page upon a resolution error, without notifying the user, if it's a valid and reachable page on the internet. Although, this may cause the edge-case problem where you have an erroneous redirect, without the user knowing why, when they were expecting to resolve /ipfs/ content from their own gateway.

It's funny how github.com/ipfs/kubo/* matches this criteria, isn't it? Sort of like shooting yourself in the foot, almost. foot

welcome[bot] commented 1 year ago

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review. In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within seven business days. If this does not happen, feel free to leave a comment. Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

Finally, remember to use https://discuss.ipfs.io if you just need general support.

whizzzkid commented 1 year ago

Thanks for submitting this issue @bradcarnage, this is indeed weird. However I'm unable to reproduce this. For me that link on brave takes me to the github repo. ipfs://kubo seems like a wrong link.

For me clicking on the IPFS link takes me to ipfs://kubo which is indeed wrong.

Image

This looks like a bad substitution in brave which seems to be redirecting <host>/ipfs/<cid> so for https://github.com/ipfs/kubo or any repo for that matter, the repo becomes the <cid>. I don't believe this is related to companion.

CC: @lidel what's the best project to open this issue with brave?

whizzzkid commented 1 year ago

I believe this check is not doing it's job well: https://github.com/brave/brave-core/blob/f4a4edd875a3c00201c593506e913200a9207fce/components/ipfs/ipfs_utils.cc#L141

lidel commented 1 year ago

Yes, this is a bug in Brave, already tracked in https://github.com/brave/brave-browser/issues/29078. Closing. @bradcarnage if you could comment on the brave issue that will be very helpful. :pray:

FYI redirect setting in Brave is separate from the one in companion. Brave setting is opt-in. If you disable redirect in Brave then you will still be able to rely on the redirect provided by ipfs-companion, and the ipfs://kubo bug should be gone.

@whizzzkid fysa we've talked with Brave that ipfs-companion should have ability read IPFS-related settings, and also modify them. That API is wip (https://github.com/brave/brave-browser/issues/31199) but no ETA yet. Once we have it, companion will be able to disable upstream redirects, ensuring only ones provided by itself are used.