Skip to content
This repository has been archived by the owner on Mar 22, 2022. It is now read-only.

Broken CID column on DNSLink gateway #42

Closed
lidel opened this issue Sep 24, 2020 · 0 comments · Fixed by #43
Closed

Broken CID column on DNSLink gateway #42

lidel opened this issue Sep 24, 2020 · 0 comments · Fixed by #43
Assignees
Labels
kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization

Comments

@lidel
Copy link
Member

lidel commented Sep 24, 2020

There is a problem when directory listing happens on DNSLink gateway (website under own domain name, backed by go-ipfs+DNSLink)

How to reproduce

To illustrate, if I render HTML like this (with go-ipfs 0.7.0):

$ curl -H "Host: dist.ipfs.io" -sD - "http://127.0.0.1:8080/go-ipfs/v0.7.0"

The breadcrumbs are broken:

          Index of
          /ipns/<a href="/ipns/dist.ipfs.io">dist.ipfs.io</a>/<a href="/ipns/dist.ipfs.io/go-ipfs">go-ipfs</a>/<a href="/ipns/dist.ipfs.io/go-ipfs/v0.7.0">v0.7.0</a>

Links under filenames are ok, but direct links to CID under truncated CIDs are broken:

        <td>
          <a href="/go-ipfs/v0.7.0/go-ipfs_v0.7.0_windows-amd64.zip.sha512">go-ipfs_v0.7.0_windows-amd64.zip.sha512</a>
        </td>
        <td class="no-linebreak">
          
          <a class="ipfs-hash" href="/ipfs/QmZwRgWU2St6St7bQi1uAh2j6EQHEJsTxuY7igVDi3dY1h">
            QmZw…dY1h
          </a>

This is because the /ipfs/... gateway is not mounted under DNSLink hostnames.
That is why attempt to load content path will fail:

$ curl -H "Host: dist.ipfs.io" -sD - "http://127.0.0.1:8080/ipfs/QmZwRgWU2St6St7bQi1uAh2j6EQHEJsTxuY7igVDi3dY1h"
HTTP/1.1 404 Not Found

TLDR

Good news is that the main link under filename continue to work, what is broken is this newly added CID column Its broken on DNSLink websites such as https://dist.ipfs.io/go-ipfs/v0.7.0 (when loaded without redirect to local gateway).

How to fix

  • Quick&dirty fix is to hide CID colum and disable links to /ipfs and /ipns when used on DNSLink gateway (path being /ipns/{Host} where Host match value from the header of the same name)
  • A proper fix require additional analysis
    • It should be possible to make breadcrumbs functional
    • ... but I don't think we can fix CID colum in DNSLink mod: we don't have knowledge if there is a public gateway available at all, and probably don't want to hardcode links to ipfs.io.
      • 💔 perhaps it should remain hidden in that mode?
      • 💚 or, to keep UI the same everywhere, when /ipfs/<cid> is not available, link to https://cid.ipfs.io#<cid> instead
  • sidenote: while working on this disable IPFS Companion to ensure you are looking at DNSlink gateway (context of this bug), and not the subdomain gateway at *.ipns.localhost (no bug in subdomain contexts)
@lidel lidel added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels Sep 24, 2020
@lidel lidel self-assigned this Sep 25, 2020
lidel added a commit that referenced this issue Sep 26, 2020
- Links to direct CIDs now have ?filename= param to preserve name and content type
- When page is loaded on DNSLink website (based on Host header) then
  there is no public gateway endpoint.
  As a replacement, clicking on a CID opens it at cid.ipfs.io

Context: #42

Closes #42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant