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

gateway: fix further resolution of dnslink failures #5199

Closed
wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented 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 [email protected]

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 <[email protected]>
@ghost ghost added kind/bug A bug in existing code (including security flaws) topic/gateway Topic gateway labels Jul 7, 2018
@ghost ghost requested a review from Stebalien July 7, 2018 01:30
@ghost ghost requested a review from Kubuxu as a code owner July 7, 2018 01:30
@ghost ghost self-assigned this Jul 7, 2018
@ghost ghost added the status/in-progress In progress label Jul 7, 2018
@ghost
Copy link
Author

ghost commented Jul 7, 2018

This isn't correct yet -- we'll want to still carry on with the request if we "successfully" get a NXDOMAIN response from DNS.

Stebalien added a commit that referenced this pull request Jul 7, 2018
Namesys returns `ErrResolveRecursion` when it stops recursing due to a depth
limit. It doesn't return success.

Alternative to #5199.

License: MIT
Signed-off-by: Steven Allen <[email protected]>
@ghost
Copy link
Author

ghost commented Jul 8, 2018

Replaced by #5202

@ghost ghost closed this Jul 8, 2018
@ghost ghost removed the status/in-progress In progress label Jul 8, 2018
@ghost ghost deleted the fix/dnslink-recursion branch January 20, 2019 18:59
This pull request was closed.
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) topic/gateway Topic gateway
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants