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

Mixed Content Warning when using localhost Gateway #328

Closed
lidel opened this issue Dec 9, 2017 · 6 comments · Fixed by #853
Closed

Mixed Content Warning when using localhost Gateway #328

lidel opened this issue Dec 9, 2017 · 6 comments · Fixed by #853
Labels
help wanted Seeking public contribution on this issue kind/discussion Topical discussion; usually not changes to codebase topic/design-ux UX strategy, research, not solely visual design topic/security Work related to security

Comments

@lidel
Copy link
Member

lidel commented Dec 9, 2017

This one is kind of Rube Goldberg machine, so I'll start with a bit of background information.

Mixed Content warning happens when a page loaded over HTTPS contains a resource (eg. image) that is loaded from insecure HTTP. Browser vendors recognized that loading content over unencrypted HTTP from the box browser is running on is a special case that provides similar security guarantees to HTTPS over the internet, so they whitelisted 127.0.0.1 and it no longer trigger the warning.

IPFS Companion defaults to using localhost instead of 127.0.0.1 since #291 was closed. To be more specific, if user enters gateway URL that includes 127.0.0.1 it will be replaced with hostname localhost.

The goal was to improve UX in Location Bar (localhost looks much better than raw IP), but it came with unexpected side effect regarding Mixed Content whitelisting implemented in Firefox and Chrome. It seems that browsers whitelisted 127.0.0.1 but not localhost, which still produces Mixed Content warning.

In our use case, the Mixed Content Warning is triggered when there is an IPFS resource on HTTPS page and ipfs-companion's redirect loads it from Local Gateway that has localhost in its URL.


(I used pls.watch as a PoC in examples below, because it is a public HTTPS site that enables users to trigger Mixed Content Warning by loading external resources from HTTP URLs)

127.0.0.1 (O.K.)

Firefox: the green padlock

2017-12-09-125633_713x31_scrot

Chrome: the green padlock + "Secure"

2017-12-09-125808_853x62_scrot

localhost (Mixed Content Warning)

Firefox: grey padlock with warning

2017-12-09-125548_691x29_scrot

2017-12-09-125858_1147x1421_scrot

2017-12-09-125707_655x60_scrot

Chrome: no padlock, warning under (i) icon

2017-12-09-125837_1145x1419_scrot


For now, we need to decide what is more important:

  • keeping human-readable localhost in Location Bar at a cost of signaling that use of local IPFS gateway is somehow "not secure"

or

  • keeping "the green padlock" at a cost of going back to 127.0.0.1 in location bar.

Personally, I think "keeping the green padlock" is more important and we should go back and default to 127.0.0.1. Rationale: we can work with browser vendors to whitelist localhost and switch back to it at a later time, when it does not cause Mixed Content Warning.

I am usually biased towards security over UX, so would love to hear what others think before doing any changes.


References:

@lidel lidel added kind/discussion Topical discussion; usually not changes to codebase topic/security Work related to security UX help wanted Seeking public contribution on this issue labels Dec 9, 2017
@ghost
Copy link

ghost commented Dec 10, 2017

I think the OS is a concern we should doublecheck -- I know that both FF and Chrome have been pretty inconsistent on multiple vectors when it comes to IPv6 DNS (changed behaviour over time, different behaviour on different OSes, config flag removals). This in particular doesn't directly affect what we're doing, it's just something to check.

Otherwise sounds good to me!

@lidel
Copy link
Member Author

lidel commented Dec 10, 2017

@lgierth yeah, after I created this issue started playing with ::1 and found various edge cases that need to be tested/addressed first, so I removed note about ipv6 from this issue to keep it on topic.
Will get back to it in separate issue, for now its safer to default to ipv4 (127.0.0.1).

@olizilla
Copy link
Member

olizilla commented Dec 12, 2017

I'm in favour of switching back to 127.0.0.1 and fixing the mixed content warning.

@lidel lidel closed this as completed in 70624a8 Dec 13, 2017
@lidel
Copy link
Member Author

lidel commented Dec 13, 2017

Alright, this change landed in v2.1.1beta6 🌵

lidel referenced this issue Dec 14, 2017
- longer hostnames are truncated and no longer break status popup
- `127.0.0.1` is normalized to `localhost` when Preferences are saved
- IPFS resources on localhost are excluded from gateway redirect
  (this solves problems with multiple nodes running locally)
- closes #291
@feilongfl
Copy link

same problem here,my website https://musing-pare-9e8d81.netlify.com/

it show me that

Mixed Content: The page at 'https://musing-pare-9e8d81.netlify.com/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://feilong-server.lan:8080/ipns/feilong.ml/comic.json'. This request has been blocked; the content must be served over HTTPS.

@lidel
Copy link
Member Author

lidel commented Oct 2, 2019

For the record, this changed at some point and
https://pls.watch/#i=http://localhost:8080/ipfs/QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR now works in both Chrome 78 and Firefox 69 without mixed-content warnings:

ff-2019-10-02--09-53-41
chrome-2019-10-02--09-53-23

We should flip normalization, as localhost looks much better than raw IP.
PR: #780

@lidel lidel reopened this Oct 2, 2019
@jessicaschilling jessicaschilling added topic/design-ux UX strategy, research, not solely visual design and removed UX labels Mar 30, 2020
@lidel lidel closed this as completed in #853 Apr 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Seeking public contribution on this issue kind/discussion Topical discussion; usually not changes to codebase topic/design-ux UX strategy, research, not solely visual design topic/security Work related to security
Projects
None yet
4 participants