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

only resolve dnslinks once in the gateway #4977

Merged
merged 2 commits into from
Jun 3, 2018
Merged

only resolve dnslinks once in the gateway #4977

merged 2 commits into from
Jun 3, 2018

Conversation

Stebalien
Copy link
Member

If the domain has a DNS-Link, we want to use it even if it points to, e.g., an IPNS address that doesn't resolve.

fixes #4973

@Stebalien Stebalien requested a review from Kubuxu as a code owner April 25, 2018 07:05
@ghost ghost assigned Stebalien Apr 25, 2018
@ghost ghost added the status/in-progress In progress label Apr 25, 2018
@Stebalien
Copy link
Member Author

This should add tests but testing DNS is a bit tricky. Thoughts?

Copy link
Member

@magik6k magik6k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I think it's possible to write a test for this - see https://github.com/ipfs/go-ipfs/blob/master/core/corehttp/gateway_test.go#L132

@Stebalien
Copy link
Member Author

@magik6k thanks! This now has tests.

@Stebalien Stebalien added need/review Needs a review and removed status/in-progress In progress labels Apr 25, 2018
Copy link
Member

@magik6k magik6k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, 1 nitpick

@@ -7,6 +7,7 @@ import (
"strings"

"github.com/ipfs/go-ipfs/core"
opts "github.com/ipfs/go-ipfs/namesys/opts"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either drop prefix or add to the import above too

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@Kubuxu Kubuxu added RFM and removed need/review Needs a review labels Apr 26, 2018
@Stebalien Stebalien removed the status/in-progress In progress label Jun 3, 2018
If the domain has a DNS-Link, we want to use it even if it points to, e.g., an
IPNS address that doesn't resolve.

fixes #4973

License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
@ghost ghost added the status/in-progress In progress label Jun 3, 2018
@Stebalien Stebalien removed the status/in-progress In progress label Jun 3, 2018
@whyrusleeping whyrusleeping merged commit f7a9809 into master Jun 3, 2018
@whyrusleeping whyrusleeping deleted the fix/4973-1 branch June 3, 2018 09:20
ghost pushed a commit that referenced this pull request Jul 7, 2018
A while ago, we noticed that if IpnsHostname failed to look up
a dnslink for a hostname in a Host header, it wouldn't respond
with an error, but instead just skip the Host header part and
carry on.

In the issue were this was flagged, the example was:
`_dnslink.tr.wikipedia-on-ipfs.org => /ipns/QmSomeKey`
This key had stopped to resolve, and thus the resolution of
/ipns/tr.wikipedia-on-ipfs.org would fail. Now you'd expect
an error response, but instead it'd happily continue processing
the request, disregarding the Host header, and allowing requests
to e.g. http://tr.wikipedia-on-ipfs.org/ipns/libp2p.io to succeed.

A previous patch (#4977) tried to work around this
issue by limiting the recursion depth of Host: header dnslink
resolutions to 1.

In this patch we start to correctly handle the initial resolution
error and stop processing the request, and we remove the earlier
workaround.

License: MIT
Signed-off-by: Lars Gierth <larsg@systemli.org>
hacdias pushed a commit to ipfs/boxo that referenced this pull request Jan 27, 2023
only resolve dnslinks once in the gateway

This commit was moved from ipfs/kubo@f7a9809
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unresolvable dnslink record allows /ipfs/ traffic
4 participants