-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Conversation
This should add tests but testing DNS is a bit tricky. Thoughts? |
There was a problem hiding this 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
@magik6k thanks! This now has tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, 1 nitpick
core/corehttp/ipns_hostname.go
Outdated
@@ -7,6 +7,7 @@ import ( | |||
"strings" | |||
|
|||
"github.com/ipfs/go-ipfs/core" | |||
opts "github.com/ipfs/go-ipfs/namesys/opts" |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
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>
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>
only resolve dnslinks once in the gateway This commit was moved from ipfs/kubo@f7a9809
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