-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: allow localhost http endpoints #28
Conversation
This is insecure and should not be implemented. It is in direct violation of RFC 8484: DoH is DNS over HTTPS, not DNS over HTTP. |
Insecure is not a "thing" by itself. Security is relative to a security model. For example, in the context of web browsers (generally a security-sensitive space) a context is considered "secure" under a particular security model (see https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts). That model includes HTTPS with TLS certificates bound to domain names and certified by trusted Certificate Authorities, but it also includes HTTP requests to locahost, 127.0.0.1, etc. Is there a particular security concern / model that you had in mind?
That's true, and yet due to the inconvenience of this coupled with the fact that it is trivial to support DNS-over-HTTP in addition to DNS-over-HTTPS other applications used widely in the DNS space have chosen to support this. For example: CoreDNS
For example: Bind9 / dig (maintained / under the umbrella of https://www.isc.org/)
I didn't spend as much time digging in there, but In short, it seems like the RFC attempted to be very prescriptive about using HTTPS, but since with many stacks it's fairly straightforward to support both HTTP and HTTPS and there's utility in supporting HTTP a number of groups have chosen to ignore the RFC and support both HTTP and HTTPS anyway.
So to the matter at hand. Why not?
|
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.
Hm.. my understanding of motivation behind this PR is to allow use of self-hosted custom resolver.
Such things, to make sense, have to run on localhost, and do not go unencrypted over network. Approach similar to how web browsers mark localhost as secure context, and expose windo.crypto and other Web APIs even when the root document was loaded from local server without TLS.
Agree we should not allow unencrypted HTTP outside of localhost – misconfigurations happen and RFC Marten mentioned is stric ton purpose, to avoid situation where people's DNS queries are sent in cleartext over network.
As a pragmatic compromise, pushed 18cfb6d with refactor that limits this PR to localhost, following spirit of secure contexts in browsers and https://datatracker.ietf.org/doc/html/draft-west-let-localhost-be-localhost
If non-localhost http://
URL is used, NewResolver returns an error.
Added tests to ensure this behavior does not regress.
Allows using HTTP in addition to HTTPS as a DNS endpoint. This makes self-hosting DNS resolvers much easier as there's no need to get a domain name, TLS certs from a CA, etc. One particular example of this is making it easier for folks to self-host local non-ICANN resolvers such as for ENS, Handshake, OpenNIC, etc.
Related to ipfs/boxo#645