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

localhost ipv6 address parsing adds extra brackets #668

Closed
chaseadam opened this issue Jan 24, 2019 · 2 comments · Fixed by #671
Closed

localhost ipv6 address parsing adds extra brackets #668

chaseadam opened this issue Jan 24, 2019 · 2 comments · Fixed by #671
Assignees
Labels
kind/bug A bug in existing code (including security flaws)

Comments

@chaseadam
Copy link

Adding extra brackets around the local ipv6 address when passed to the browser resulting in:
Failed to parse URL from http://[[::1]]:5001/api/v0/

Chromium on Fedora 29

the following error is on Firefox:

Error while ipfs.swarm.peers: SyntaxError: The URI is malformed
screenshot from 2019-01-24 17-13-32
screenshot from 2019-01-24 17-13-18
screenshot from 2019-01-24 17-13-11

@lidel lidel added the kind/bug A bug in existing code (including security flaws) label Jan 28, 2019
@lidel
Copy link
Member

lidel commented Jan 29, 2019

Thank you for reporting this.
It seems to be a bug inside of js-ipfs-http-client. I will prepare an upstream fix.

@lidel
Copy link
Member

lidel commented Jan 29, 2019

The origin of the problem is in stream-http (library used internally by js-ipfs-http-client), key issues being:

  • merging the meaning of host and hostname BEFORE validating ipv6
  • performing naive check by looking for : to identify ipv6 here

Upstream fix:

PS. Noticed something odd during the URI debug: for some reason "browserified" version of hostname attribute in test environment removes square brackets, but real browser and node do not do that:

browser (FF64) node v10.15.0 "browserified"
newurl-ipv6-2019-01-29--12-34-20 2019-01-29--12-56-54 2019-01-29--12-55-34 ¯_(ツ)_/¯

lidel added a commit that referenced this issue Jan 30, 2019
Removing square brackets from hostname until the problem is fixed
upstream in `stream-http`.

Details in
#668 (comment)

Closes #668
lidel added a commit that referenced this issue Jan 30, 2019
Removing square brackets from hostname until the problem is fixed
upstream in `stream-http`.

Details in
#668 (comment)

Closes #668
@ghost ghost removed the status/in-progress In progress label Jan 30, 2019
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)
Projects
None yet
2 participants