XMPP | P. Saint-Andre |
Internet-Draft | &yet |
Obsoletes: 6122 (if approved) | June 3, 2015 |
Intended status: Standards Track | |
Expires: December 5, 2015 |
Extensible Messaging and Presence Protocol (XMPP): Address Format
draft-ietf-xmpp-6122bis-23
This document defines the address format for the Extensible Messaging and Presence Protocol (XMPP), including support for code points outside the ASCII range. This document obsoletes RFC 6122.
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on December 5, 2015.
Copyright (c) 2015 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
The Extensible Messaging and Presence Protocol (XMPP) [RFC6120] is an application profile of the Extensible Markup Language [XML] for streaming XML data in close to real time between any two or more network-aware entities. The address format for XMPP entities was originally developed in the Jabber open-source community in 1999, first described by [XEP-0029] in 2002, and then defined canonically by [RFC3920] in 2004 and [RFC6122] in 2011.
As specified in RFC 3920 and RFC 6122, the XMPP address format used the "stringprep" technology for preparation and comparison of non-ASCII characters [RFC3454]. Following the movement of internationalized domain names away from stringprep, this document defines the XMPP address format in a way that no longer depends on stringprep (see the PRECIS problem statement [RFC6885]). Instead, this document builds upon the internationalization framework defined by the IETF's PRECIS Working Group [RFC7564].
Although every attempt has been made to ensure that the characters allowed in Jabber Identifiers (JIDs) under Stringprep are still allowed and handled in the same way under PRECIS, there is no guarantee of strict backward compatibility because of changes in Unicode and the fact that PRECIS handling is based on Unicode properties, not a hardcoded table of characters. Because it is possible that previously-valid JIDs might no longer be valid (or previously-invalid JIDs might now be valid), operators of XMPP services are advised to perform careful testing before migrating accounts and other data (see Section 6.1 of [I-D.ietf-precis-saslprepbis] for guidance).
This document obsoletes RFC 6122.
Many important terms used in this document are defined in [RFC7564], [RFC5890], [RFC6120], [RFC6365], and [Unicode].
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].
An XMPP entity is anything that can communicate using XMPP. For historical reasons, the network address of an XMPP entity is called a Jabber Identifier ("JID"). A valid JID is a string of Unicode code points [Unicode], encoded using UTF-8 [RFC3629], and structured as an ordered sequence of localpart, domainpart, and resourcepart, where the first two parts are demarcated by the '@' character used as a separator and the last two parts are similarly demarcated by the '/' character (e.g., <juliet@example.com/balcony>).
The syntax for a JID is defined as follows using the Augmented Backus-Naur Form (ABNF) as specified in [RFC5234].
jid = [ localpart "@" ] domainpart [ "/" resourcepart ] localpart = 1*1023(userbyte) ; ; a "userbyte" is a byte used to represent a ; UTF-8 encoded Unicode code point that can be ; contained in a string that conforms to the ; "UsernameCaseMapped" profile of the PRECIS ; IdentifierClass ; domainpart = IP-literal / IPv4address / ifqdn ; ; the "IPv4address" and "IP-literal" rules are ; defined in RFC 3986, and the first-match-wins ; (a.k.a. "greedy") algorithm described therein ; applies to the matching process ; ; note well that reuse of the IP-literal rule from ; RFC 3986 implies that IPv6 addresses are enclosed ; in square brackets (i.e., beginning with '[' and ; ending with ']') ; ifqdn = 1*1023(domainbyte) ; ; a "domainbyte" is a byte used to represent a ; UTF-8 encoded Unicode code point that can be ; contained in a string that conforms to RFC 5890 ; resourcepart = 1*1023(opaquebyte) ; ; an "opaquebyte" is a byte used to represent a ; UTF-8 encoded Unicode code point that can be ; contained in a string that conforms to the ; "OpaqueString" profile of the PRECIS ; FreeformClass ;
All JIDs are based on the foregoing structure. However, note that the formal syntax provided above does not capture all of the rules and restrictions that apply to JIDs, which are described below.
Each allowable portion of a JID (localpart, domainpart, and resourcepart) is 1 to 1023 octets in length, resulting in a maximum total size (including the '@' and '/' separators) of 3071 octets.
This document defines the native format for JIDs; see [RFC5122] for information about the representation of a JID as a Uniform Resource Identifier (URI) [RFC3986] or Internationalized Resource Identifier (IRI) [RFC3987] and the extraction of a JID from an XMPP URI or IRI.
The domainpart of a JID is that portion which remains once any portion from the first '/' character to the end of the string has been removed (if there is a '/' character present), and then any portion from the beginning of the string to the first '@' character (if there is a '@' character present). The domainpart is the primary identifier and is the only REQUIRED element of a JID (a mere domainpart is a valid JID). Typically a domainpart identifies the "home" server to which clients connect for XML routing and data management functionality. However, it is not necessary for an XMPP domainpart to identify an entity that provides core XMPP server functionality (e.g., a domainpart can identify an entity such as a multi-user chat service [XEP-0045], a publish-subscribe service [XEP-0060], or a user directory).
The domainpart for every XMPP service MUST be a fully-qualified domain name (FQDN), an IPv4 address, an IPv6 address, or an unqualified hostname (i.e., a text label that is resolvable on a local network).
If the domainpart includes a final character considered to be a label separator (dot) by [RFC1034], this character MUST be stripped from the domainpart before the JID of which it is a part is used for the purpose of routing an XML stanza, comparing against another JID, or constructing an XMPP URI or IRI [RFC5122]. In particular, such a character MUST be stripped before any other canonicalization steps are taken.
In general, the content of a domainpart is an Internationalized Domain Name ("IDN") as described in the specifications for Internationalized Domain Names in Applications (commonly called "IDNA2008"), and a domainpart is an "IDNA-aware domain name slot" as defined in [RFC5890].
After any and all normalization, conversion, and mapping of code points as well as encoding of the string as UTF-8, a domainpart MUST NOT be zero octets in length and MUST NOT be more than 1023 octets in length. (Naturally, the length limits of [RFC1034] apply, and nothing in this document is to be interpreted as overriding those more fundamental limits.)
Detailed rules and considerations for preparation, enforcement, and comparison are provided in the following sections.
An entity that prepares a string for inclusion in an XMPP domainpart slot MUST ensure that the string consists only of Unicode code points that are allowed in NR-LDH labels or U-labels as defined in [RFC5890]. This implies that the string MUST NOT include A-labels as defined in [RFC5890]; each A-label MUST be converted to a U-label during preparation of a string for inclusion in a domainpart slot. In addition, the string MUST be encoded as UTF-8 [RFC3629].
An entity that performs enforcement in XMPP domainpart slots MUST prepare a string as described in the previous section and MUST also apply the normalization, case-mapping, and width-mapping rules defined in [RFC5892].
An entity that performs comparison of two strings before or after their inclusion in XMPP domainpart slots MUST prepare each string and enforce the normalization, case-mapping, and width-mapping rules specified in the previous two sections. The two strings are to be considered equivalent if they are an exact octet-for-octet match (sometimes called "bit-string identity").
The localpart of a JID is an optional identifier placed before the domainpart and separated from the latter by the '@' character. Typically a localpart uniquely identifies the entity requesting and using network access provided by a server (i.e., a local account), although it can also represent other kinds of entities (e.g., a chat room associated with a multi-user chat service [XEP-0045]). The entity represented by an XMPP localpart is addressed within the context of a specific domain (i.e., <localpart@domainpart>).
The localpart of a JID MUST NOT be zero octets in length and MUST NOT be more than 1023 octets in length. This rule is to be enforced after any normalization and mapping of code points as well as encoding of the string as UTF-8.
The localpart of a JID is an instance of the UsernameCaseMapped profile of the PRECIS IdentifierClass, which is specified in [I-D.ietf-precis-saslprepbis]. The rules and considerations provided in that specification MUST be applied to XMPP localparts.
In XMPP, the following characters are explicitly disallowed in XMPP localparts even though they are allowed by the IdentifierClass base class and the UsernameCaseMapped profile:
The resourcepart of a JID is an optional identifier placed after the domainpart and separated from the latter by the '/' character. A resourcepart can modify either a <localpart@domainpart> address or a mere <domainpart> address. Typically a resourcepart uniquely identifies a specific connection (e.g., a device or location) or object (e.g., an occupant in a multi-user chat room [XEP-0045]) belonging to the entity associated with an XMPP localpart at a domain (i.e., <localpart@domainpart/resourcepart>).
XMPP entities SHOULD consider resourceparts to be opaque strings and SHOULD NOT impute meaning to any given resourcepart. In particular:
The resourcepart of a JID MUST NOT be zero octets in length and MUST NOT be more than 1023 octets in length. This rule is to be enforced after any normalization and mapping of code points as well as encoding of the string as UTF-8.
The resourcepart of a JID is an instance of the OpaqueString profile of the PRECIS FreeformClass, which is specified in [I-D.ietf-precis-saslprepbis]. The rules and considerations provided in that specification MUST be applied to XMPP resourceparts.
In some contexts, it might be appropriate to apply more restrictive rules to the preparation, enforcement, and comparison of XMPP resourceparts. For example, in XMPP Multi-User Chat [XEP-0045] it might be appropriate to apply the rules specified in [I-D.ietf-precis-nickname]. However, the application of more restrictive rules is out of scope for resourceparts in general and is properly defined in specifications for the relevant XMPP extensions.
The following examples illustrate a small number of JIDs that are consistent with the format defined above (note that the characters < and > are used to delineate the actual JIDs and are not part of the JIDs themselves).
Table 1: A sample of legal JIDs
+----------------------------------+-------------------------------+ | # | JID | Notes | +----------------------------------+-------------------------------+ | 1 | <juliet@example.com> | A "bare JID" | +----------------------------------+-------------------------------+ | 2 | <juliet@example.com/foo> | A "full JID" | +----------------------------------+-------------------------------+ | 3 | <juliet@example.com/foo bar> | Single space in resourcepart | +----------------------------------+-------------------------------+ | 4 | <juliet@example.com/foo@bar> | At sign in resourcepart | +----------------------------------+-------------------------------+ | 5 | <foo\20bar@example.com> | Single space in localpart, as | | | | optionally escaped using the | | | | XMPP "JID Escaping" extension | +----------------------------------+-------------------------------+ | 6 | <fussball@example.com> | Another bare JID | +----------------------------------+-------------------------------+ | 7 | <fußball@example.com> | The third character is LATIN | | | | SMALL LETTER SHARP S (U+00DF) | +----------------------------------+-------------------------------+ | 8 | <π@example.com> | A localpart of GREEK SMALL | | | | LETTER PI (U+03C0) | +----------------------------------+-------------------------------+ | 9 | <Σ@example.com/foo> | A localpart of GREEK CAPITAL | | | | LETTER SIGMA (U+03A3) | +----------------------------------+-------------------------------+ | 10| <σ@example.com/foo> | A localpart of GREEK SMALL | | | | LETTER SIGMA (U+03C3) | +----------------------------------+-------------------------------+ | 11| <ς@example.com/foo> | A localpart of GREEK SMALL | | | | LETTER FINAL SIGMA (U+03C2) | +----------------------------------+-------------------------------+ | 12| <king@example.com/♚>; | A resourcepart of the Unicode | | | | character BLACK CHESS KING | | | | (U+265A) | +----------------------------------+-------------------------------+ | 13| <example.com> | A domainpart | +----------------------------------+-------------------------------+ | 14| <example.com/foobar> | A domainpart and resourcepart | +----------------------------------+-------------------------------+ | 15| <a.example.com/b@example.net>| A domainpart followed by a | | | | resourcepart that contains an | | | | at sign | +----------------------------------+-------------------------------+
Several points are worth noting. Regarding examples 6 and 7: although in German the character esszett (LATIN SMALL LETTER SHARP S, U+00DF) can mostly be used interchangeably with the two characters "ss", the localparts in these examples are different and (if desired) a server would need to enforce a registration policy that disallows one of them if the other is registered. Regarding examples 9, 10, and 11: case-mapping of GREEK CAPITAL LETTER SIGMA (U+03A3) to lowercase (i.e., to GREEK SMALL LETTER SIGMA, U+03C3) during comparison would result in matching the JIDs in examples 9 and 10; however, because the PRECIS mapping rules do not account for the special status of GREEK SMALL LETTER FINAL SIGMA (U+03C2), the JIDs in examples 9 and 11 or examples 10 and 11 would not be matched. Regarding example 12: symbol characters such as BLACK CHESS KING (U+265A) are allowed by the PRECIS FreeformClass and thus can be used in resourceparts. Regarding examples 14 and 15: JIDs consisting of a domainpart and resourcepart are rarely seen in the wild, but are allowed according to the XMPP address format. Example 15 illustrates the need for careful extraction of the domainpart as described in the first paragraph of Section 3.2.
The following examples illustrate strings that are not JIDs because they violate the format defined above.
Table 2: A sample of strings that violate the JID rules
+----------------------------------+-------------------------------+ | # | Non-JID string | Notes | +----------------------------------+-------------------------------+ | 16| <"juliet"@example.com> | Quotation marks (U+0022) in | | | | localpart | +----------------------------------+-------------------------------+ | 17| <foo bar@example.com> | Space (U+0020) in localpart | +----------------------------------+-------------------------------+ | 18| <juliet@example.com/ foo> | Leading space in resourcepart | +----------------------------------+-------------------------------+ | 19| <@example.com/> | Zero-length localpart and | | | | resourcepart | +----------------------------------+-------------------------------+ | 20| <henryⅣ@example.com> | The sixth character is ROMAN | | | | NUMERAL FOUR (U+2163) | +----------------------------------+-------------------------------+ | 21| <♚@example.com> | A localpart of BLACK CHESS | | | | KING (U+265A) | +----------------------------------+-------------------------------+ | 22| <juliet@> | A localpart without a | | | | domainpart | +----------------------------------+-------------------------------+ | 23| </foobar> | A resourcepart without a | | | | domainpart | +----------------------------------+-------------------------------+
Here again, several points are worth noting. Regarding example 17, even though ASCII SPACE (U+0020) is disallowed in the PRECIS IdentifierClass, it can be escaped to "\20" in XMPP localparts by using the JID Escaping rules defined in [XEP-0106], as illustrated by example 4 in Table 1. Regarding example 20, the Unicode character ROMAN NUMERAL FOUR (U+2163) has a compatibility equivalent of the string formed of LATIN CAPITAL LETTER I (U+0049) and LATIN CAPITAL LETTER V (U+0056), but characters with compatibility equivalents are not allowed in the PRECIS IdentiferClass. Regarding example 21: symbol characters such as BLACK CHESS KING (U+265A) are not allowed in the PRECIS IdentifierClass; however, both of the non-ASCII characters in examples 20 and 21 are allowed in the PRECIS Freeform class and therefore in the XMPP resourcepart (as illustrated for U+265A by example 12 in Table 1). Regarding examples 22 and 23: the domainpart is required in a JID.
Enforcement entails applying all of the rules specified in this document. Enforcement of the XMPP address format rules is the responsibility of XMPP servers. Although XMPP clients SHOULD prepare complete JIDs and parts of JIDs in accordance with this document before including them in protocol slots within XML streams, XMPP servers MUST enforce the rules wherever possible and reject stanzas and other XML elements that violate the rules (for stanzas, by returning a <jid-malformed/> error to the sender as described in Section 8.3.3.8 of [RFC6120]).
Entities that enforce the rules specified in this document are encouraged to be liberal in what they accept by following this procedure:
Enforcement applies to complete JIDs and to parts of JIDs. To facilitate implementation, this document defines the concepts of "JID slot", "localpart slot", and "resourcepart slot" (similar to the concept of a "domain name slot" for IDNA2008 defined in Section 2.3.2.6 of [RFC5890]):
A server is responsible for enforcing the address format rules when receiving protocol elements from clients where the server is expected to handle such elements directly or to use them for purposes of routing a stanza to another domain or delivering a stanza to a local entity; two examples from [RFC6120] are the 'to' attribute on XML stanzas (which is a JID slot used by XMPP servers for routing of outbound stanzas) and the <resource/> child of the <bind/> element (which is a resourcepart slot used by XMPP servers for binding of a resource to an account for routing of stanzas between the server and a particular client). An example from [RFC6121] is the 'jid' attribute of the roster <item/> element.
A server is not responsible for enforcing the rules when the protocol elements are intended for communication among other entities, typically within the payload of a stanza that the server is merely routing to another domain or delivering to a local entity. Two examples are the 'initiator' attribute in the Jingle extension [XEP-0166] (which is a JID slot used for client-to-client coordination of multimedia sessions) and the 'nick' attribute in the Multi-User Chat extension [XEP-0045] (which is a resourcepart slot used for administrative purposes in the context of XMPP chatrooms). In such cases, the entities involved SHOULD enforce the rules themselves and not depend on the server to do so, and client implementers need to understand that not enforcing the rules can lead to a degraded user experience or to security vulnerabilities. However, when an add-on service (e.g., a multi-user chat service) handles a stanza directly, it ought to enforce the rules as well, as defined in the relevant specification for that type of service.
This document does not provide an exhaustive list of JID slots, localpart slots, or resourcepart slots. However, implementers of core XMPP servers are advised to consider as JID slots at least the following elements and attributes when they are handled directly or used for purposes of routing to another domain or delivering to a local entity:
Developers of XMPP clients and specialized XMPP add-on services are advised to check the appropriate specifications for JID slots, localpart slots, and resourcepart slots in XMPP protocol extensions such as Service Discovery [XEP-0030], Multi-User Chat [XEP-0045], Publish-Subscribe [XEP-0060], SOCKS5 Bytestreams [XEP-0065], In-Band Registration [XEP-0077], Roster Item Exchange [XEP-0144], and Jingle [XEP-0166].
XMPP applications MUST support IDNA2008 for domainparts as described under Section 3.2, the "UsernameCaseMapped" profile for localparts as described under Section 3.3, and the "OpaqueString" profile for resourceparts as described under Section 3.4. This enables XMPP addresses to include a wide variety of characters outside the ASCII range. Rules for enforcement of the XMPP address format are provided in [RFC6120] and specifications for various XMPP extensions.
The Stringprep specification [RFC3454] did not provide for entries in the Stringprep Profiles registry to be marked as anything except current or not current. Because this document obsoletes RFC 6122, which registered the "Nodeprep" and "Resourceprep" profiles, IANA is requested at the least to mark those profiles as not current (preferably with a pointer to this document).
The security considerations described in [RFC7564] apply to the "IdentifierClass" and "FreeformClass" base string classes used in this document for XMPP localparts and resourceparts, respectively. The security considerations described in [RFC5890] apply to internationalized domain names, which are used here for XMPP domainparts.
The security considerations described in [UTS39] apply to the use of Unicode characters in XMPP addresses.
There are two forms of address spoofing: forging and mimicking.
In the context of XMPP technologies, address forging occurs when an entity is able to generate an XML stanza whose 'from' address does not correspond to the account credentials with which the entity authenticated onto the network (or an authorization identity provided during negotiation of SASL authentication [RFC4422] as described in [RFC6120]). For example, address forging occurs if an entity that authenticated as "juliet@im.example.com" is able to send XML stanzas from "nurse@im.example.com" or "romeo@example.net".
Address forging is difficult in XMPP systems, given the requirement for sending servers to stamp 'from' addresses and for receiving servers to verify sending domains via server-to-server authentication (see [RFC6120]). However, address forging is possible if:
Therefore, an entity outside the security perimeter of a particular server cannot reliably distinguish between JIDs of the form <localpart@domainpart> at that server and thus can authenticate only the domainpart of such JIDs with any level of assurance. This specification does not define methods for discovering or counteracting the kind of poorly implemented or rogue servers just described. However, the end-to-end authentication or signing of XMPP stanzas could help to mitigate this risk, since it would require the rogue server to generate false credentials for signing or encryption of each stanza, in addition to modifying 'from' addresses.
Address mimicking occurs when an entity provides legitimate authentication credentials for and sends XML stanzas from an account whose JID appears to a human user to be the same as another JID. Because many characters are visually similar, it is relatively easy to mimic JIDs in XMPP systems. As one simple example, the localpart "ju1iet" (using the Arabic numeral one as the third character) might appear the same as the localpart "juliet" (using lowercase "L" as the third character).
As explained in [RFC5890], [RFC7564], [UTR36], and [UTS39], there is no straightforward solution to the problem of visually similar characters. Furthermore, IDNA and PRECIS technologies do not attempt to define such a solution. As a result, XMPP domainparts, localparts, and resourceparts could contain such characters, leading to security vulnerabilities such as the following:
XMPP services and clients are strongly encouraged to define and implement consistent policies regarding the registration, storage, and presentation of visually similar characters in XMPP systems. In particular, service providers and software implementers are strongly encouraged to apply the policies recommended in [RFC7564].
This section describes a protocol feature set that summarizes the conformance requirements of this specification (similar feature sets are provided for XMPP in [RFC6120] and [RFC6121]). The summary is purely informational and the conformance keywords of [RFC2119] as used here are intended only to briefly describe the referenced normative text from the body of this specification. This feature set is appropriate for use in software certification, interoperability testing, and implementation reports. For each feature, this section provides the following information:
The feature set specified here provides a basis for interoperability testing and follows the spirit of a proposal made by Larry Masinter within the IETF's NEWTRK Working Group in 2005 [INTEROP].
Based on consensus derived from working group discussion, implementation and deployment experience, and formal interoperability testing, the following substantive modifications were made from RFC 6122.
Thanks to Ben Campbell, Dave Cridland, Miguel Garcia, Joe Hildebrand, Jonathan Lennox, Matt Miller, Florian Schmaus, Sam Whited, and Florian Zeitz for their input during working group discussion.
Dan Romascanu provided a helpful review on behalf of the General Area Review Team.
Thanks also to Matt Miller in his role as document shepherd, Joe Hildebrand in his role as working group chair, and Ben Campbell in his role as sponsoring Area Director.
The author wishes to acknowledge Cisco Systems, Inc., for employing him during his work on earlier versions of this document.