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

Do not redirect IPFS resources if hostname is 'localhost:*' #604

Closed
lidel opened this issue Oct 6, 2018 · 3 comments
Closed

Do not redirect IPFS resources if hostname is 'localhost:*' #604

lidel opened this issue Oct 6, 2018 · 3 comments
Assignees
Labels
kind/bug A bug in existing code (including security flaws) status/ready Ready to be worked

Comments

@lidel
Copy link
Member

lidel commented Oct 6, 2018

<deni> IPFS desktop opens localhost:5001/ipfs/[hash] and companion redirects to localhost:8080/ipfs/[hash]

Background

This does not happen in companion alone, because it normalizes localhost to 127.0.0.1 to avoid mixed-content warnings in we browsers, and we already ignore gateways at 127.0.0.1.

Test Link: http://localhost:5001/ipfs/QmQLXHs7K98JNQdWrBB2cQLJahPhmupbDjRuH1b9ibmwVa/

Fix

U guess we probably should do both:

  1. Companion ignores gateways on localhost
  2. Desktop opens links with 127.0.0.1 instead of localhost

@hacdias thoughts?

@lidel lidel added kind/bug A bug in existing code (including security flaws) status/ready Ready to be worked labels Oct 6, 2018
@hacdias
Copy link
Member

hacdias commented Oct 6, 2018

@lidel I think it would be better for Companion to ignore gateways on localhost. I know Electron can register specific protocol handlers (like ipfs:// or dweb://) but as far as I've searched, I can't find information on how to open 'regular' URLs for a specific domain, which leads me to conclude that it is not easily possible.

@lidel lidel self-assigned this Oct 6, 2018
@lidel
Copy link
Member Author

lidel commented Oct 6, 2018

@hacdias what I meant was to normalize localhost to 127.0.0.1 in API and Gateway port settings.
Eg. if user enters API port as localhost:5001, it should be replaced with the IP version.
(but yeah, on top of that, Companion should ignore localhost )

@hacdias
Copy link
Member

hacdias commented Oct 6, 2018

@lidel gotcha! I agree then 😄

lidel added a commit that referenced this issue Oct 19, 2018
- ignored requests are identified early and cached across all
  browser.webRequest.* hooks
- global toggle now correctly disables all hooks and workarounds
- Closes #604
lidel added a commit that referenced this issue Oct 26, 2018
- ignored requests are identified early and cached across all
  browser.webRequest.* hooks
- global toggle now correctly disables all hooks and workarounds
- Closes #604
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) status/ready Ready to be worked
Projects
None yet
Development

No branches or pull requests

2 participants