For the e-mail app we are planning to reuse Thunderbird's
auto-configuration mechanism to facilitate account setup:
https://developer.mozilla.org/en/Thunderbird/Autoconfiguration
One of its heuristics after failing to find explicit autoconfiguration
directives for a domain is to look up the MX entry for the domain to
attempt to determine the hosting provider which may in turn have
configuration information available.
There are three main ways to accomplish this for the e-mail app:
1) Expose a Web API for DNS resolution capable of providing other record
types.
2) Have apps use the pending TCP API and/or a new UDP API to issue DNS
queries themselves. There is an MIT licensed node library that could be
used as a basis for this:
https://github.com/tjfontaine/node-dns
3) Don't try and run the query on the client, but instead have a
(web)server do the query. Because of past and current Gecko platform
limitations, this is what Thunderbird does, but not what it wants to do
(
https://bugzilla.mozilla.org/show_bug.cgi?id=563958 ). There is some
promising platform work happening to address the Gecko platform
limitation:
https://bugzilla.mozilla.org/show_bug.cgi?id=735967
I understand from the bug traffic and elsewhere that XMPP clients would
also be interested in this functionality.
The main argument in favor of such an API is the ability of the platform
to eventually provide additional confidence in replies, such as
performing DNSSEC validation and/or being augmented to securely ask
other observers on the internet to confirm their lookups returned
similar-enough values.
Potential arguments against such an API are that DNS queries can be used
to leak information (ex: tcp-over-dns) and it might be hard to explain
the permission and do so without being confusing/annoying. Information
leakage would only be relevant in a tightly locked down execution model
where an app is running without meaningful network access or in an
attack where the attacker has managed to get some JS running in the
app's context but CSP/other policy makes it hard for the attacker to
exfiltrate the information to a server they control via easier means.
Andrew