From 136875eb33c5869824db5f04aa2b68d396ae083b Mon Sep 17 00:00:00 2001 From: moparisthebest Date: Fri, 15 Dec 2023 22:44:52 -0500 Subject: [PATCH] Add Rationale to host-meta-2 --- inbox/host-meta-2.xml | 39 +++++++++++++++++++++++++++++++++++++-- xep.ent | 3 ++- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/inbox/host-meta-2.xml b/inbox/host-meta-2.xml index 96131133..abcbdfb2 100644 --- a/inbox/host-meta-2.xml +++ b/inbox/host-meta-2.xml @@ -35,9 +35,9 @@

Although &xmppcore; specifies the use of TCP as the method of connecting to an XMPP server, alternative connection methods exist, including the &xep0124; method (for which &xep0206; is the XMPP profile), the websocket - subprotocol specified in &rfc7395;, &xep0368;, &xep0467;, and &xep0468;, and surely others that don't yet exist. For some of these methods, it is necessary to discover further parameters before connecting, such as the HTTPS URL of a BOSH or WebSocket request. Without ways to auto-discover these parameters, the relevant information would need to be provided manually by a human user (which is cumbersome and error-prone) or hard-coded into XMPP software applications (which is brittle and not interoperable + subprotocol specified in &rfc7395;, &xep0368;, &xep0467;, and &xep0468;, and surely others that don't yet exist. For some of these methods, it is necessary to discover further parameters before connecting, such as the HTTPS URL of a BOSH or WebSocket request. Without ways to auto-discover these parameters, the relevant information would need to be provided manually by a human user (which is cumbersome and error-prone) or hard-coded into XMPP software applications (which is brittle and not interoperable) ).

-

Additional things also require automatic discovery, like &rfc7711; (replaced here by pinning public keys instead like &rfc7469;), &tls-ech;, SNI names, and ALPN protocols. The web solves these problems in HTTP3 by introducing another set of DNS records (SVCB and HTTPS) but that poses a problem for XMPP because we don't have the clout to introduce our own DNS records and hope for any sort of adoption with the myriad DNS setup panels most people use. Additionally while we all hope and pray for DNSSEC (and DANE), many TLDs don't yet support it, and we can't trust this info over plaintext (note the web doesn't trust it over plaintext either, DNS-over-TLS is a requirement for ECH).

+

Additional things also require automatic discovery, like &rfc7711; (replaced here by pinning public keys instead like &rfc7469;), &tls-ech;, SNI names, and ALPN protocols.

This document defines a way to encapsulate information about all these connection methods and parameters for auto-discovery via Link entries in a server's "host-meta.json" file. It also provides a flag to signal to the client or server that all info is here and no other methods need be used.

@@ -204,6 +204,41 @@ Access-Control-Allow-Origin: *

Keep in mind this json file is defined in an RFC and we need to keep backwards compatibility with it, software only implementing XEP-0156 should be able to read and use this file as extended by this XEP only seeing the websocket/bosh connections.

+ + +

Here I will go through alternative solutions that were explored and explain their deficiencies and why they were not chosen.

+ +
    +
  • SRV records cannot hold the additional parameters needed and are not extensible.
  • +
  • The web solves these problems in HTTP3 by introducing another set of DNS records (&rfc9460;) but that poses a problem for XMPP because we don't have the clout to introduce our own DNS records and hope for any sort of adoption with the myriad of DNS setup panels most people use.
  • +
  • We could register our own SvcParamKeys and use SVCB records, but that suffers the same problem as above.
  • +
  • Perhaps most importantly, while we all hope and pray for DNSSEC (and DANE), many TLDs don't yet support it, and we can't trust this info (pinned keys or secure delegation) without cryptographic authenticity.
  • +
  • Some of these parameters not even the web trusts over plaintext, DNS-over-TLS/HTTPS is a requirement for ECH.
  • +
  • TXT records can hold arbitrary data, but the authenticity/privacy problems above persist, practical size limits make this a non-starter, and writing a custom parser isn't great from a security perspective.
  • +
+
+ +
    +
  • XMPP uses XML right? So we already have a XML parser to use! Actually no, XMPP uses a (very) strict subset of XML, and an XML parser properly configured to parse XMPP *will not* parse host-meta.xml. Some more security conscious XML parsers are explicitly built for XMPP and cannot be configured to parse host-meta.xml. It is *dangerous* from a security perspective to have an XML parser capable of parsing host-meta.xml anywhere in your client/server, see CVE-2022-0217.
  • +
  • Extending host-meta.xml the ideal way where things that can only have 1 value per link and should be an attribute (like port) would require namespaced attributes which are not widely supported or currently used at all in XMPP (though legal).
  • +
  • It would also require dummy values in Link like href='DUMMY' or so when a port is set. Or introducing another tag... Regardless it won't be very clean, and I consider the first issue a complete deal breaker.
  • +
+
+ +
    +
  • A major design goal here is enabling 1 single fetch to get everything needed to connect to a server. This file already exists and is already being grabbed by clients, since we can extend it without breaking compatibility with those clients, this doesn't introduce another network fetch.
  • +
  • &rfc7711; already exists for clients and servers and uses JSON, same parser can be used.
  • +
  • As stated in the section above, I find a JSON parser much less of a potential security vulnerability to have available than an XML parser capable of parsing host-meta.xml
  • +
+
+ +
    +
  • host-meta.json has an 'expires' key defined already, why 'ttl' instead? I was almost convinced to use this until I realized this means that the file needs served by a program that can update 'expires' dynamically on fetch, or at least on a schedule, and that is far more complicated and therefore less preferable than a simple ttl that never needs updated allowing clients to keep track of their own expiry.
  • +
  • What would be the next best option? Well I think a new file over https/.well-known that is in an XMPP-subset-of-XML format and so can safely share the same parser. It would be similar to HACX which was rejected with the direction to look into extending &xep0156;, which this is doing.
  • +
+
+
+

It should be noted this allows your web host to hijack your XMPP connection, but that's actually been true for quite some time, they could already bypass the need for a certificate with POSH, or get one from LetsEncrypt if you didn't have the proper CAA records, or hijack it for websocket/bosh supporting clients, so this doesn't really open up new avenues of attack.

Please refer to the security considerations and warnings of &rfc7469; with regards to having a backup public key and being careful to not break your domain for the whole TTL

diff --git a/xep.ent b/xep.ent index 815ec32b..fb20b9b8 100644 --- a/xep.ent +++ b/xep.ent @@ -710,6 +710,7 @@ THE SOFTWARE. RFC 7677 RFC 7677: SCRAM-SHA-256 and SCRAM-SHA-256-PLUS Simple Authentication and Security Layer (SASL) Mechanisms <http://tools.ietf.org/html/rfc7677>." > RFC 5705 RFC 5705: Keying Material Exporters for Transport Layer Security (TLS) <http://tools.ietf.org/html/rfc5705>." > RFC 9266 RFC 9266: Channel Bindings for TLS 1.3 <http://tools.ietf.org/html/rfc9266>." > +RFC 9460 RFC 9460: Service Binding and Parameter Specification via the DNS (SVCB and HTTPS Resource Records) <http://tools.ietf.org/html/rfc9460>." > @@ -1688,4 +1689,4 @@ IANA Service Location Protocol, Version 2 (SLPv2) Templates SASL Upgrade Tasks (XEP-0480)XEP-0480: SASL Upgrade Tasks <https://xmpp.org/extensions/xep-0480.html>."> Content Types in Messages (XEP-0481)XEP-0481: Content Types in Messages <https://xmpp.org/extensions/xep-0481.html>."> Call Invites (XEP-0482)XEP-0482: Call Invites <https://xmpp.org/extensions/xep-0482.html>."> -HTTP Online Meetings (XEP-0483)XEP-0483: HTTP Online Meetings <https://xmpp.org/extensions/xep-0483.html>.">Fast Authentication Streamlining Tokens (XEP-0484)XEP-0484: Fast Authentication Streamlining Tokens <https://xmpp.org/extensions/xep-0484.html>."> \ No newline at end of file +HTTP Online Meetings (XEP-0483)XEP-0483: HTTP Online Meetings <https://xmpp.org/extensions/xep-0483.html>.">Fast Authentication Streamlining Tokens (XEP-0484)XEP-0484: Fast Authentication Streamlining Tokens <https://xmpp.org/extensions/xep-0484.html>.">