RFC 7622

Extensible Messaging and Presence Protocol (XMPP): Address Format

πŸ“… published September 2015, from ietf

Extensible Messaging and Presence Protocol (XMPP): Address Format ✨

Okay bestie, this is RFC 7622 πŸ’Œ, and it's giving main character energy. It's from the Internet Engineering Task Force (IETF) and was written by P. Saint-Andre from &yet πŸ¦‹. It came out in September 2015 as a Standards Track document, which means it's an official Internet standard, not just a suggestion πŸ‘‘. It has ISSN 2070-1721, and it obsoletes RFC 6122, so if you're still using 6122 as your source of truth, it's time to switch 🫢. This is part 1 of 6.

Abstract

So basically, this doc defines the address format for XMPP (the Extensible Messaging and Presence Protocol) πŸ’¬, and it's extra iconic because it supports code points outside the ASCII range 🌈. It also obsoletes RFC 6122 πŸ“.

Status of This Memo

This is an Internet Standards Track document πŸ“œ.

It's a product of the IETF, and it represents the consensus of the IETF community 🫢. It went through public review and got approved for publication by the Internet Engineering Steering Group (IESG) ✨. If you want more info on Internet Standards, check out Section 2 of RFC 5741 πŸ’….

Info about the current status of this document, any errata, and how to give feedback is at http://www.rfc-editor.org/info/rfc7622 πŸ”—.

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) as they stand on the publication date of this document. Please read these carefully, bestie, because they spell out your rights and restrictions for this document πŸ™ˆ. Code Components pulled out of this document must include the Simplified BSD License text, as described in Section 4.e of the Trust Legal Provisions, and they come without warranty, as the Simplified BSD License describes πŸŽ€.

Table of Contents

   1. Introduction ....................................................2
   2. Terminology .....................................................3
   3. Addresses .......................................................3
      3.1. Fundamentals ...............................................3
      3.2. Domainpart .................................................5
      3.3. Localpart ..................................................7
      3.4. Resourcepart ...............................................8
      3.5. Examples ...................................................9
   4. Enforcement in JIDs and JID Parts ..............................13
   5. Internationalization Considerations ............................15
   6. IANA Considerations ............................................16
      6.1. Stringprep Profiles Registry ..............................16
   7. Security Considerations ........................................16
      7.1. Reuse of PRECIS ...........................................16
      7.2. Reuse of Unicode ..........................................16
      7.3. Address Spoofing ..........................................16
   8. Conformance Requirements .......................................19
   9. References .....................................................21
      9.1. Normative References ......................................21
      9.2. Informative References ....................................22
   Appendix A. Differences from RFC 6122 .............................26
   Acknowledgements ..................................................27
   Author's Address ..................................................27

1. Introduction 🌸

So XMPP [RFC6120] is an application profile of the Extensible Markup Language [XML] for streaming XML data almost in real time between any two or more network-aware entities πŸ’¬. The XMPP address format was first developed in the Jabber open-source community back in 1999 ⏳. It was first described by [XEP-0029] in 2002, and then formally defined by [RFC3920] in 2004 and [RFC6122] in 2011 πŸŽ€.

As RFCs 3920 and 6122 specify, the XMPP address format used the "stringprep" technology for preparing and comparing non-ASCII characters [RFC3454]. But internationalized domain names moved away from stringprep, so this document defines the XMPP address format in a way that no longer depends on stringprep (see the Preparation, Enforcement, and Comparison of Internationalized Strings (PRECIS) problem statement [RFC6885]) πŸ”„. Instead, it builds on the internationalization framework from the IETF's PRECIS working group [RFC7564] πŸ¦‹.

Here's the tea β˜•: the team really tried to keep the characters that were allowed in Jabber Identifiers (JIDs) under stringprep still allowed and handled the same way under PRECIS. But there's no guarantee of strict backward compatibility, because Unicode changes and PRECIS handling is based on Unicode properties rather than a hardcoded table of characters 😭. That means previously valid JIDs might stop being valid, or previously invalid JIDs might become valid, so XMPP service operators are advised to do careful testing before migrating accounts and other data (see Section 6 of [RFC7613] for guidance) πŸ™ˆ.

This document obsoletes RFC 6122 πŸ’….

2. Terminology πŸ“š

Lots of important terms in this doc 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] ✨.

3. Addresses 🧚

3.1. Fundamentals

Okay so an XMPP entity is anything that can communicate using XMPP πŸ’–. For historical reasons, the network address of an XMPP entity is called a 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. The first two parts are separated by the @ character, and the last two are separated by the / character. For example: <juliet@example.com/balcony> 🧁.

The syntax for a JID is defined below, 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 defined in RFC 7613
                  ;
   domainpart   = IP-literal / IPv4address / ifqdn
                  ;
                  ; the "IPv4address" and "IP-literal" rules are
                  ; defined in RFCs 3986 and 6874, respectively,
                  ; and the first-match-wins (a.k.a. "greedy")
                  ; algorithm described in Appendix B of RFC 3986
                  ; applies to the matching process
                  ;
   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 defined in RFC 7613
                  ;

All JIDs follow the structure above 🧩. But fair warning: the formal syntax doesn't capture every rule and restriction that applies to JIDs, and those extra rules are described below πŸ‘€.

Each allowable portion of a JID (localpart, domainpart, and resourcepart) is 1 to 1023 octets long, which means the maximum total size is 3071 octets once you count the @ and / separators πŸ“.

Implementation Note: The length limits on JIDs and their parts are counted in octets (bytes), not characters. UTF-8 encoding can use more than one octet per character, so keep that in mind 🫣.
Implementation Note: When you split a JID into its component parts, an implementation has to match the separator characters @ and / before applying any transformation algorithms. Why? Because some transformations might decompose certain Unicode code points into those separator characters 🧠.
Implementation Note: Reusing the IP-literal rule from [RFC6874] means IPv6 addresses are enclosed in square brackets (starting with [ and ending with ]). That wasn't the case in the XMPP address format defined in [RFC3920], but [RFC6122] changed it πŸ”. Also, the IP-literal rule got updated between [RFC3986] and [RFC6874] so it can optionally add a zone identifier to any literal address 🌈.

This document defines the native format for JIDs. For info on representing a JID as a Uniform Resource Identifier (URI) [RFC3986] or Internationalized Resource Identifier (IRI) [RFC3987], and on pulling a JID out of an XMPP URI or IRI, check out [RFC5122] πŸ’–βœ¨.

3.2. Domainpart πŸ’–

okay so the domainpart is whatever's left of a JID after you do two little parsing steps πŸ’…

  1. Remove any portion from the first / character to the end of the string (if there is a / character present).
  2. Remove any portion from the beginning of the string to the first @ character (if there is an @ character present).

this parsing order is important πŸ™ˆ, as illustrated by example 15 in Section 3.5.

the domainpart is the primary identifier and is the only REQUIRED element of a JID (a mere domainpart is a valid JID) πŸ‘‘. usually it identifies the "home" server that clients connect to for XML routing and data management stuff ✨. but it doesn't have to be a server doing core XMPP work! a domainpart can also point to things like 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 πŸ’€. so strip that trailing dot first, bestie!

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 πŸ¦‹.

Informational Note: The term "fully qualified domain name" is not well defined. In [RFC1034], it is also called an absolute domain name, and the two terms are associated in [RFC1535]. The earliest use of the term can be found in [RFC1123]. References to those older specifications ought not to be construed as limiting the characters of a fully qualified domain name to the ASCII range; for example, [RFC5890] mentions that a fully qualified domain name can contain one or more U-labels. πŸ€“
Interoperability Note: Domainparts that are IP addresses might not be accepted by other services for the purpose of server-to-server communication, and domainparts that are unqualified hostnames cannot be used on public networks because they are resolvable only on a local network. 🚫

3.2.1. Preparation πŸŽ€

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] ✨.

3.2.2. Enforcement πŸ’…

an entity that performs enforcement in XMPP domainpart slots MUST prepare a string as described in Section 3.2.1 and MUST also apply the normalization, case-mapping, and width-mapping rules defined in [RFC5892] πŸ”₯.

Informational Note: The order in which the rules are applied for IDNA2008 (see [RFC5892] and [RFC5895]) is different from the order for localparts and resourceparts as described under Sections 3.3 and 3.4. πŸ™ƒ

3.2.3. Comparison πŸ¦‹

an entity that performs comparison of two strings before or after their inclusion in XMPP domainpart slots MUST prepare each string as specified in Section 3.2.1 and then enforce the normalization, case-mapping, and width-mapping rules specified in Section 3.2.2. the two strings are to be considered equivalent if they are an exact octet-for-octet match (sometimes called "bit-string identity") πŸ“.


3.3. Localpart 🌸

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 chatroom 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 [RFC7613]. the rules and considerations provided in that specification MUST be applied to XMPP localparts πŸ”₯.

Implementation Note: XMPP uses the Simple Authentication and Security Layer (SASL) [RFC4422] for authentication. At the time of this writing, some SASL mechanisms use SASLprep [RFC4013] for the handling of usernames and passwords; in the future, these SASL mechanisms will likely transition to the use of PRECIS-based handling rules as specified in [RFC7613]. For a detailed discussion about the implications of that transition (including the potential need to modify or remove certain characters in the underlying account database), see both Section 6 and Appendix A of [RFC7613]. 🧚

3.3.1. Further Excluded Characters 🚫

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 πŸ™…β€β™€οΈ:

  • " U+0022 (QUOTATION MARK)
  • & U+0026 (AMPERSAND)
  • ' U+0027 (APOSTROPHE)
  • / U+002F (SOLIDUS)
  • : U+003A (COLON)
  • < U+003C (LESS-THAN SIGN)
  • > U+003E (GREATER-THAN SIGN)
  • @ U+0040 (COMMERCIAL AT)
Implementation Note: An XMPP-specific method for escaping the foregoing characters (along with U+0020, i.e., ASCII space) has been defined in the JID Escaping specification [XEP-0106]. πŸͺ„

3.4. Resourcepart πŸ¦„

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 chatroom [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:

  • Use of the / character as a separator between the domainpart and the resourcepart does not imply that XMPP addresses are hierarchical in the way that, say, HTTP URIs are hierarchical (see [RFC3986] for general discussion). thus, for example, an XMPP address of the form <localpart@domainpart/foo/bar> does not identify a resource "bar" that exists below a resource "foo" in a hierarchy of resources associated with the entity "localpart@domainpart" πŸ™ƒ.
  • The @ character is allowed in the resourcepart and is often used in the "handle" shown in XMPP chatrooms [XEP-0045]. For example, the JID <room@chat.example.com/user@host> describes an entity who is an occupant of the room <room@chat.example.com> with a handle of <user@host>. However, chatroom services do not necessarily check such an asserted handle against the occupant's real JID πŸ‘€.

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 [RFC7613]. the rules and considerations provided in that specification MUST be applied to XMPP resourceparts 🌈.

3.4.1. Applicability to XMPP Extensions πŸŽ€

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 [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 🫢.

3.5. Examples ✨

okay bestie, time for the fun part πŸŽ€ here are some real JIDs that follow everything we just covered. quick reminder: the < and > are only there to show where each JID starts and ends. they're NOT part of the JID itself πŸ’…

+----------------------------------+-------------------------------+
| # | 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&#xDF;ball@example.com>   | The third character is LATIN  |
|   |                              | SMALL LETTER SHARP S (U+00DF) |
+----------------------------------+-------------------------------+
| 8 | <&#x3C0;@example.com>        | A localpart of GREEK SMALL    |
|   |                              | LETTER PI (U+03C0)            |
+----------------------------------+-------------------------------+
| 9 | <&#x3A3;@example.com/foo>    | A localpart of GREEK CAPITAL  |
|   |                              | LETTER SIGMA (U+03A3)         |
+----------------------------------+-------------------------------+
| 10| <&#x3C3;@example.com/foo>    | A localpart of GREEK SMALL    |
|   |                              | LETTER SIGMA (U+03C3)         |
+----------------------------------+-------------------------------+
| 11| <&#x3C2;@example.com/foo>    | A localpart of GREEK SMALL    |
|   |                              | LETTER FINAL SIGMA (U+03C2)   |
+----------------------------------+-------------------------------+
| 12| <king@example.com/&#x265A>;  | 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                     |
+----------------------------------+-------------------------------+

                      Table 1: A Sample of Legal JIDs

okay so a few things to clock in that table πŸ‘€

examples 6 and 7: in German, the esszett (LATIN SMALL LETTER SHARP S (U+00DF)) can mostly be swapped with the two characters "ss" πŸ‡©πŸ‡ͺ but these two localparts are still different. so if a server wants to, it would need to enforce a registration policy that blocks one of them when the other is already taken πŸ”’

examples 9, 10, and 11: lowercasing GREEK CAPITAL LETTER SIGMA (U+03A3) into GREEK SMALL LETTER SIGMA (U+03C3) during comparison makes examples 9 and 10 match πŸ’œ BUT the PRECIS mapping rules don't account for the special GREEK SMALL LETTER FINAL SIGMA (U+03C2), so examples 9 and 11, or examples 10 and 11, won't match. the final sigma really be out here doing its own thing 😭

example 12: symbol characters like BLACK CHESS KING (U+265A) are allowed by the PRECIS FreeformClass, so they can be used in resourceparts. β™š the king has entered the chat πŸ‘‘

examples 14 and 15: JIDs made of just a domainpart and a resourcepart are rarely seen in the wild, but the XMPP address format does allow them πŸ¦‹ example 15 shows why you need to be careful pulling out the domainpart, like we talked about in Section 3.2 🧐

The next set is strings that are not JIDs, because they break the format we went over. πŸ™ˆ

+----------------------------------+-------------------------------+
| # | 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&#x2163;@example.com>  | The sixth character is ROMAN  |
|   |                              | NUMERAL FOUR (U+2163)         |
+----------------------------------+-------------------------------+
| 21| <&#x265A;@example.com>       | A localpart of BLACK CHESS    |
|   |                              | KING (U+265A)                 |
+----------------------------------+-------------------------------+
| 22| <juliet@>                    | A localpart without a         |
|   |                              | domainpart                    |
+----------------------------------+-------------------------------+
| 23| </foobar>                    | A resourcepart without a      |
|   |                              | domainpart                    |
+----------------------------------+-------------------------------+

          Table 2: A Sample of Strings That Violate the JID Rules

and a few more things to know about these oops ones πŸ’€

example 17: even though ASCII space (U+0020) is disallowed in the PRECIS IdentifierClass, it can be escaped to "\20" in XMPP localparts using the JID Escaping rules from [XEP-0106] 🧩 that's the same trick as example 5 in Table 1, so you get the space without breaking the rules 🫢

example 20: the character ROMAN NUMERAL FOUR (U+2163) has a compatibility equivalent, which is the string made of LATIN CAPITAL LETTER I (U+0049) and LATIN CAPITAL LETTER V (U+0056). BUT characters with compatibility equivalents aren't allowed in the PRECIS IdentifierClass, so no β…£ for you πŸ™…β€β™€οΈ

example 21: symbol characters like BLACK CHESS KING (U+265A) aren't allowed in the PRECIS IdentifierClass. HOWEVER, both the non-ASCII characters in examples 20 and 21 are allowed in the PRECIS FreeformClass, which means they're fine in the XMPP resourcepart (see example 12 in Table 1 for U+265A) β™ŸοΈ the chess pieces only work in the right spot 🀭

examples 22 and 23: the domainpart is required in a JID, so a JID missing one just isn't a JID ✨

4. Enforcement in JIDs and JID Parts ✨

Okay so enforcement is basically where all the rules from this document actually get applied πŸŽ€. And here's the tea: enforcing the XMPP address format rules is the job of XMPP servers πŸ‘‘. XMPP clients SHOULD prepare complete JIDs and parts of JIDs according to this document before they stick them into protocol slots inside XML streams, bestie πŸ’…. But XMPP servers MUST enforce the rules wherever they can and reject any stanzas or other XML elements that break them (for stanzas, that means sending back a <jid-malformed/> error to the sender, as described in Section 8.3.3.8 of [RFC6120]) 😭🫢.

Entities that enforce these rules are encouraged to be generous about what they accept, and they can do it with this little routine 🌸:

  1. Where possible, map characters (for example through width mapping, additional mapping, special mapping, case mapping, or normalization) and accept the mapped string πŸ¦‹.
  2. If mapping is not possible (for example, because a character is disallowed in the FreeformClass), reject the string and return a <jid-malformed/> error πŸ’€.

Enforcement covers complete JIDs and parts of JIDs too 🧚. To make life easier, this document defines the ideas of "JID slot", "localpart slot", and "resourcepart slot". It's kind of like the "domain name slot" idea for IDNA2008 from Section 2.3.2.6 of [RFC5890] πŸ’œ:

JID Slot: An XML element or attribute that XMPP or an XMPP extension explicitly designates for carrying a complete JID πŸ“.

Localpart Slot: An XML element or attribute that XMPP or an XMPP extension explicitly designates for carrying the localpart of a JID 🌈.

Resourcepart Slot: An XML element or attribute that XMPP or an XMPP extension explicitly designates for carrying the resourcepart of a JID ⭐.

A server is responsible for enforcing the address format rules when it gets protocol elements from clients and is supposed to handle them directly, or use them to route a stanza to another domain or deliver it to a local entity πŸ”₯. Two examples from [RFC6120] are the 'to' attribute on XML stanzas (a JID slot that XMPP servers use to route outbound stanzas) and the <resource/> child of the <bind/> element (a resourcepart slot that XMPP servers use to bind a resource to an account so stanzas can be routed 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 meant for communication among other entities, usually inside the payload of a stanza that the server is just routing to another domain or delivering to a local entity πŸ™ˆ. Two examples are the 'initiator' attribute in the Jingle extension [XEP-0166] (a JID slot used for client-to-client coordination of multimedia sessions) and the 'nick' attribute in the Multi-User Chat extension [XEP-0045] (a resourcepart slot used for administrative purposes in XMPP chatrooms) 🌸. In those cases, the entities involved SHOULD enforce the rules themselves and not depend on the server to do it, and client implementers need to understand that not enforcing the rules can lead to a degraded user experience or to security vulnerabilities 😬. That said, when an add-on service (for example, a multi-user chat service) handles a stanza directly, it ought to enforce the rules too, as defined in the relevant specification for that type of service ✨.

This document does not give an exhaustive list of JID slots, localpart slots, or resourcepart slots πŸ§šβ€β™€οΈ. Still, implementers of core XMPP servers are advised to treat at least the following elements and attributes as JID slots when they're handled directly or used for routing to another domain or delivering to a local entity πŸ’…:

  • The 'from' and 'to' stream attributes and the 'from' and 'to' stanza attributes [RFC6120] πŸŽ€.
  • The 'jid' attribute of the roster <item/> element for contact list management [RFC6121] πŸ¦‹.
  • The 'value' attribute of the <item/> element for Privacy Lists [RFC3921] [XEP-0016] when the value of the 'type' attribute is "jid" 🌷.
  • The 'jid' attribute of the <item/> element for Service Discovery defined in [XEP-0030] 🌈.
  • The <value/> element for Data Forms [XEP-0004] when the 'type' attribute is "jid-single" or "jid-multi" πŸ’œ.
  • The 'jid' attribute of the <conference/> element for Bookmark Storage [XEP-0048] πŸ“.
  • The <JABBERID/> of the <vCard/> element for vCard 3.0 [XEP-0054], and the <uri/> child of the <impp/> element for vCard 4.0 [XEP-0292] when the XML character data identifies an XMPP URI [RFC5122] 🫢.
  • The 'from' attribute of the <delay/> element for Delayed Delivery [XEP-0203] ⏰.
  • The 'jid' attribute of the <item/> element for the Blocking Command [XEP-0191] 🚫.
  • The 'from' and 'to' attributes of the <result/> and <verify/> elements for Server Dialback [XEP-0220] πŸ”.
  • The 'from' and 'to' attributes of the <iq/>, <message/>, and <presence/> elements for the Jabber Component Protocol [XEP-0114] 🧩.

Developers of XMPP clients and specialised XMPP add-on services are advised to check the right specifications for JID slots, localpart slots, and resourcepart slots in XMPP extensions like 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] πŸ‘‘.


5. Internationalization Considerations 🌍

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 lets XMPP addresses include a wide variety of characters outside the ASCII range 🌏✨. Rules for enforcing the XMPP address format are in [RFC6120], plus the specifications for various XMPP extensions πŸŽ€.

Interoperability Note: For backward compatibility, many existing XMPP implementations and deployments support IDNA2003 [RFC3490] for domainparts, and the stringprep [RFC3454] profiles Nodeprep and Resourceprep [RFC3920] for localparts and resourceparts πŸ₯Ί.

6. IANA Considerations πŸ“‹

6.1. Stringprep Profiles Registry

The stringprep specification [RFC3454] did not allow entries in the "Stringprep Profiles" registry to have any state except "Current" or "Not Current" πŸ™ƒ. Because this document obsoletes RFC 6122, which registered the Nodeprep and Resourceprep profiles of stringprep, IANA marked those profiles as "Not Current" and cited this document as an additional reference πŸ₯€.

7. Security Considerations πŸ”

7.1. Reuse of PRECIS

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 🌐.

7.2. Reuse of Unicode

The security considerations described in [UTS39] apply to the use of Unicode characters in XMPP addresses 🚨.

7.3. Address Spoofing

There are two forms of address spoofing: forging and mimicking πŸ₯·. Bestie, this one is serious 😱.

7.3.1. Address Forging

In the context of XMPP technologies, address forging happens when an entity can generate an XML stanza whose 'from' address doesn't match the account credentials it authenticated onto the network with (or an authorization identity provided during SASL authentication [RFC4422], as described in [RFC6120]) πŸ’€. For example, address forging happens if an entity that authenticated as "juliet@im.example.com" can send XML stanzas from "nurse@im.example.com" or "romeo@example.net" 😭.

Address forging is hard in XMPP systems, since sending servers have to stamp 'from' addresses and receiving servers have to verify sending domains through server-to-server authentication (see [RFC6120]) πŸ”’. However, address forging IS possible if:

  • A poorly implemented server ignores the requirement to stamp the 'from' address. This would let any entity that authenticated with the server send stanzas from any localpart@domainpart, as long as the domainpart matches the sending domain of the server 🫠.
  • An actively malicious server generates stanzas on behalf of any registered account at the domain or domains hosted at that server πŸ‘Ώ.

So an entity outside the security perimeter of a particular server cannot reliably tell apart JIDs of the form <localpart@domainpart> at that server, and it can only authenticate the domainpart of such JIDs with any level of assurance 🫣. This specification does NOT define methods for discovering or countering the kind of poorly implemented or rogue servers just described πŸ™…β€β™€οΈ. However, end-to-end authentication or signing of XMPP stanzas could help mitigate this risk, because the rogue server would then have to generate false credentials for signing or encryption of each stanza, on top of modifying 'from' addresses πŸ”‘βœ¨.

7.3.2. Address Mimicking 🎭

Okay so address mimicking is when someone logs in with totally legit credentials and sends XML stanzas from an account whose JID looks like another JID to a human. Lowkey iconic (for the wrong reasons πŸ’€). Lots of characters look almost identical, so it's really easy to fake a JID in XMPP. For example, the localpart ju1iet (with the Arabic numeral one as the third character) can look exactly like juliet (with a lowercase "L" as the third character). Scary, right? 😭

As [RFC5890], [RFC7564], [UTR36], and [UTS39] explain, there's no straightforward fix for visually similar characters. IDNA and PRECIS don't try to solve it either. So XMPP domainparts, localparts, and resourceparts can contain these lookalike characters, and that opens the door to security problems like these:

  • Domainpart confusion 🏰: The domainpart is always part of an entity's address in XMPP. A common use is naming a server or a server-side service, like a multi-user chat service [XEP-0045]. If people read an internationalized domainpart in different ways, the security of those services can break. A user might authorize a malicious entity at a fake server to see their presence information, or they might join chatrooms at a fake multi-user chat service.
  • Localpart confusion πŸ‘€: The localpart can also be part of an entity's address. It's often a username, but it can also be the name of a multi-user chatroom, and lots of other entities use localparts in their addresses too. If people read an internationalized localpart differently, things go sideways. A user typing a single internationalized localpart could reach another user's account information, or get into a hidden or restricted chatroom or service.
  • Resourcepart mixups πŸŽ€: The resourcepart is also one piece of an entity's address. Usually it's the name of an instant messaging user's connected resource, but it can also be someone's nickname in a multi-user chatroom, and plenty of other entities use it too. Confusable resourceparts can be a real problem. Two or more lookalike resources could be bound to the same account at once, which leads to inconsistent authorization decisions in an XMPP application that uses full JIDs. A user could also accidentally send a private message to the wrong person in a multi-user chatroom 😱.

XMPP services and clients are strongly encouraged to define and implement consistent policies for registering, storing, and presenting visually similar characters. Service providers and software implementers are especially encouraged to apply the policies recommended in [RFC7564]. Please don't skip this, bestie 🫢.


8. Conformance Requirements πŸ“‹

Okay, this section is a summary of the conformance requirements in this spec. It's basically a cheat sheet ✨. Similar feature sets exist for XMPP in [RFC6120] and [RFC6121]. This summary is purely informational. The conformance keywords from [RFC2119] are used here only to briefly describe the normative text in the body of the spec. The feature set is great for software certification, interoperability testing, and implementation reports πŸ’…. For each feature, the section gives you:

  • A human-readable name
  • An informational description
  • A reference to the section of this document that normatively defines the feature
  • Whether the feature applies to the client role, the server role, or both (where "N/A" means the feature doesn't apply to the specified role)
  • Whether the feature MUST or SHOULD be implemented, where the capitalized terms are understood as described in [RFC2119]

The feature set follows the spirit of a proposal Larry Masinter made within the IETF's NEWTRK working group in 2005 [INTEROP] and gives a basis for interoperability testing. Here's the full list πŸ¦‹:

Feature:  address-domain-length

Description:  Ensure that the domainpart of an XMPP address is at
   least one octet in length and at most 1023 octets in length, and
   that it conforms to the underlying length limits of the DNS.

Section:  Section 3.2

Roles:  Server MUST, client SHOULD.

Feature:  address-domain-prep

Description:  Ensure that the domainpart of an XMPP address conforms
   to IDNA2008, that it contains only NR-LDH labels and U-labels (not
   A-labels), and that all uppercase and titlecase code points are
   mapped to their lowercase equivalents.

Section:  Section 3.2

Roles:  Server MUST, client SHOULD.


Feature:  address-localpart-length

Description:  Ensure that the localpart of an XMPP address is at
   least one octet in length and at most 1023 octets in length.

Section:  Section 3.3

Roles:  Server MUST, client SHOULD.


Feature:  address-localpart-prep

Description:  Ensure that the localpart of an XMPP address conforms
   to the UsernameCaseMapped profile of the PRECIS IdentifierClass.

Section:  Section 3.3

Roles:  Server MUST, client SHOULD.


Feature:  address-resource-length

Description:  Ensure that the resourcepart of an XMPP address is at
   least one octet in length and at most 1023 octets in length.

Section:  Section 3.4

Roles:  Server MUST, client SHOULD.

Feature:  address-resource-prep

Description:  Ensure that the resourcepart of an XMPP address
   conforms to the OpaqueString profile of the PRECIS FreeformClass.

Section:  Section 3.4

Roles:  Server MUST, client SHOULD.

9. References πŸ“š

9.1. Normative References

[RFC1034]  Mockapetris, P., "Domain names - concepts and facilities",
           STD 13, RFC 1034, DOI 10.17487/RFC1034, November 1987,
           <http://www.rfc-editor.org/info/rfc1034>.

[RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
           Requirement Levels", BCP 14, RFC 2119,
           DOI 10.17487/RFC2119, March 1997,
           <http://www.rfc-editor.org/info/rfc2119>.

[RFC3629]  Yergeau, F., "UTF-8, a transformation format of
           ISO 10646", STD 63, RFC 3629, DOI 10.17487/RFC3629,
           November 2003, <http://www.rfc-editor.org/info/rfc3629>.

[RFC3986]  Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
           Resource Identifier (URI): Generic Syntax", STD 66,
           RFC 3986, DOI 10.17487/RFC3986, January 2005,
           <http://www.rfc-editor.org/info/rfc3986>.

[RFC5234]  Crocker, D., Ed., and P. Overell, "Augmented BNF for
           Syntax Specifications: ABNF", STD 68, RFC 5234,
           DOI 10.17487/RFC5234, January 2008,
           <http://www.rfc-editor.org/info/rfc5234>.

[RFC5890]  Klensin, J., "Internationalized Domain Names for
           Applications (IDNA): Definitions and Document Framework",
           RFC 5890, DOI 10.17487/RFC5890, August 2010,
           <http://www.rfc-editor.org/info/rfc5890>.

[RFC5892]  Faltstrom, P., Ed., "The Unicode Code Points and
           Internationalized Domain Names for Applications (IDNA)",
           RFC 5892, DOI 10.17487/RFC5892, August 2010,
           <http://www.rfc-editor.org/info/rfc5892>.

[RFC6120]  Saint-Andre, P., "Extensible Messaging and Presence
           Protocol (XMPP): Core", RFC 6120, DOI 10.17487/RFC6120,
           March 2011, <http://www.rfc-editor.org/info/rfc6120>.

[RFC6365]  Hoffman, P. and J. Klensin, "Terminology Used in
           Internationalization in the IETF", BCP 166, RFC 6365,
           DOI 10.17487/RFC6365, September 2011,
           <http://www.rfc-editor.org/info/rfc6365>.

[RFC6874]  Carpenter, B., Cheshire, S., and R. Hinden, "Representing
           IPv6 Zone Identifiers in Address Literals and Uniform
           Resource Identifiers", RFC 6874, DOI 10.17487/RFC6874,
           February 2013, <http://www.rfc-editor.org/info/rfc6874>.

[RFC7564]  Saint-Andre, P. and M. Blanchet, "PRECIS Framework:
           Preparation, Enforcement, and Comparison of
           Internationalized Strings in Application Protocols",
           RFC 7564, DOI 10.17487/RFC7564, May 2015,
           <http://www.rfc-editor.org/info/rfc7564>.

[RFC7613]  Saint-Andre, P. and A. Melnikov, "Preparation,
           Enforcement, and Comparison of Internationalized Strings
           Representing Usernames and Passwords", RFC 7613,
           DOI 10.17487/RFC7613, August 2015,
           <http://www.rfc-editor.org/info/rfc7613>.

[Unicode]  The Unicode Consortium, "The Unicode Standard",
           <http://www.unicode.org/versions/latest/>.

[UTR36]    Unicode Technical Report #36, "Unicode Security
           Considerations", edited by Mark Davis and Michel Suignard,
           <http://www.unicode.org/reports/tr36/>.

9.2. Informative References ✨

okay so these are the informative refs, the "good to know" pile that isn't strictly required reading πŸ“šπŸ’…


Appendix A. Differences from RFC 6122 πŸ¦‹

so basically, after everyone argued it out in the working group and actually tried it in the wild and at interop testing, these are the big substantive changes from RFC 6122 🫢

  • domainpart prep got glow-up'd to IDNA2008 (instead of IDNA2003) ✨
  • localpart prep now uses the UsernameCaseMapped profile of the PRECIS IdentifierClass (instead of the Nodeprep profile of stringprep) πŸŽ€
  • resourcepart prep now uses the OpaqueString profile of the PRECIS FreeformClass (instead of the Resourceprep profile of stringprep) πŸ’œ
  • internationalized labels within domainparts must be U-labels (instead of "should be" U-labels) 🌸
  • fullwidth and halfwidth characters must be mapped to their decomposition mappings (previously handled through the use of Normalization Form KC) πŸ“
  • Unicode Normalization Form C is the move now (instead of Unicode Normalization Form KC as specified in the Nodeprep and Resourceprep profiles of stringprep) 🌈
  • servers must enforce the address-formatting rules πŸ‘‘

Acknowledgements 🫢

huge thank yous 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 did a super helpful review on behalf of the General Area Review Team 🧚

during IESG review, Alissa Cooper, Brian Haberman, and Barry Leiba left comments that made the document way better ✨

also shoutout to Matt Miller as document shepherd, Joe Hildebrand as working group chair, and Ben Campbell as sponsoring Area Director πŸ“£

the author wants to acknowledge Cisco Systems, Inc., for employing him while he worked on earlier draft versions of this document πŸ’…

Author's Address πŸ’Œ

Peter Saint-Andre &yet

Email: peter@andyet.com URI: https://andyet.com/

πŸ“¦ where this page comes from