-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrfc7622.xml
1501 lines (1338 loc) · 65.3 KB
/
rfc7622.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc compact="yes"?>
<?rfc sortrefs="yes"?>
<?rfc symrefs="yes"?>
<?rfc toc="yes"?>
<?rfc tocdepth="2"?>
<rfc category="std" number="7622" ipr="trust200902" obsoletes="6122"
submissionType="IETF" consensus="yes">
<front>
<title abbrev="XMPP Address Format">Extensible Messaging and Presence Protocol (XMPP): Address Format</title>
<author initials="P." surname="Saint-Andre" fullname="Peter Saint-Andre">
<organization>&yet</organization>
<address>
<email>[email protected]</email>
<uri>https://andyet.com/</uri>
</address>
</author>
<date month="September" year="2015"/>
<keyword>Extensible Messaging and Presence Protocol</keyword>
<keyword>XMPP</keyword>
<keyword>Jabber</keyword>
<keyword>Messaging</keyword>
<keyword>Instant Messaging</keyword>
<keyword>Presence</keyword>
<keyword>Internationalization</keyword>
<keyword>i18n</keyword>
<keyword>PRECIS</keyword>
<abstract>
<t>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.</t>
</abstract>
</front>
<middle>
<section title="Introduction" anchor="intro">
<t>The Extensible Messaging and Presence Protocol (XMPP) <xref
target='RFC6120'/> is an application profile of the Extensible Markup
Language <xref target="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 <xref target='XEP-0029'/> in 2002, and then
defined canonically by <xref target='RFC3920'/> in 2004 and <xref
target='RFC6122'/> in 2011.</t>
<t>As specified in RFCs 3920 and 6122, the XMPP address format used the
"stringprep" technology for preparation and comparison of non-ASCII
characters <xref target='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 Preparation, Enforcement, and Comparison of Internationalized Strings
(PRECIS) problem statement <xref target='RFC6885'/>). Instead, this
document builds upon the internationalization framework defined by the
IETF's PRECIS working group <xref target='RFC7564'/>.</t>
<t>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 of <xref target='RFC7613'/>
for guidance).</t>
<t>This document obsoletes RFC 6122.</t>
</section>
<section title="Terminology" anchor="terms">
<t>Many important terms used in this document are defined in <xref
target='RFC7564'/>, <xref target='RFC5890'/>, <xref target='RFC6120'/>,
<xref target='RFC6365'/>, and <xref target='Unicode'/>.</t>
<t>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 <xref
target='RFC2119'/>.</t>
</section>
<section title="Addresses" anchor="addressing">
<section title="Fundamentals" anchor="addressing-fundamentals">
<t>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
<xref target='Unicode'/>, encoded using UTF-8 <xref target='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.,
<[email protected]/balcony>).</t>
<t>The syntax for a JID is defined as follows, using the Augmented
Backus-Naur Form (ABNF) as specified in <xref target="RFC5234"/>.</t>
<figure>
<artwork type="abnf"><![CDATA[
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
;
]]></artwork>
</figure>
<t>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.</t>
<t>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.</t>
<t><list style='empty'><t>Implementation Note: The length limits on JIDs
and parts of JIDs are based on octets (bytes), not characters. UTF-8
encoding can result in more than one octet per character.</t></list></t>
<t><list style='empty'><t>Implementation Note: When dividing a JID into
its component parts, an implementation needs to match the separator
characters '@' and '/' before applying any transformation algorithms,
which might decompose certain Unicode code points to the separator
characters.</t></list></t>
<t><list style='empty'><t>Implementation Note: Reuse of the IP-literal
rule from <xref target='RFC6874'/> implies that IPv6 addresses are
enclosed within square brackets (i.e., beginning with '[' and ending
with ']'), which was not the case with the definition of the XMPP
address format in <xref target='RFC3920'/> but which was changed in
<xref target='RFC6122'/>. Also note that the IP-literal rule was
updated between <xref target='RFC3986'/> and <xref target='RFC6874'/> to
optionally add a zone identifier to any literal address.</t></list></t>
<t>This document defines the native format for JIDs; see <xref
target="RFC5122"/> for information about the representation of a JID as
a Uniform Resource Identifier (URI) <xref target="RFC3986"/> or
Internationalized Resource Identifier (IRI) <xref target="RFC3987"/> and
the extraction of a JID from an XMPP URI or IRI.</t>
</section>
<section title="Domainpart" anchor="addressing-domainpart">
<t>The domainpart of a JID is the portion that remains once the
following parsing steps are taken:</t>
<t>
<list style='numbers'>
<t>Remove any portion from the first '/' character to the end of the
string (if there is a '/' character present).</t>
<t>Remove any portion from the beginning of the string to the first
'@' character (if there is an '@' character present).</t>
</list>
</t>
<t>This parsing order is important, as illustrated by example 15 in
<xref target='addressing-examples'/>.</t>
<t>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 <xref target='XEP-0045'/>, a publish-subscribe
service <xref target='XEP-0060'/>, or a user directory).</t>
<t>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).</t>
<t><list style='empty'><t>Informational Note: The term "fully qualified
domain name" is not well defined. In <xref target='RFC1034'/>, it is
also called an absolute domain name, and the two terms are associated in
<xref target='RFC1535'/>. The earliest use of the term can be found in
<xref target='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, <xref
target='RFC5890'/> mentions that a fully qualified domain name can
contain one or more U-labels.</t></list></t>
<t><list style='empty'><t>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.</t></list></t>
<t>If the domainpart includes a final character considered to be a label
separator (dot) by <xref target='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 <xref target='RFC5122'/>. In
particular, such a character MUST be stripped before any other
canonicalization steps are taken.</t>
<t>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 <xref target='RFC5890'/>.</t>
<t>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 <xref target='RFC1034'/>
apply, and nothing in this document is to be interpreted as overriding
those more fundamental limits.)</t>
<t>Detailed rules and considerations for preparation, enforcement, and
comparison are provided in the following sections.</t>
<section title="Preparation" anchor="addressing-domainpart-prep">
<t>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 <xref target='RFC5890'/>. This implies that the string MUST NOT
include A-labels as defined in <xref target='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 <xref target='RFC3629'/>.</t>
</section>
<section title="Enforcement" anchor="addressing-domainpart-enforce">
<t>An entity that performs enforcement in XMPP domainpart slots MUST
prepare a string as described in
<xref target="addressing-domainpart-prep"/> and MUST also apply
the normalization, case-mapping, and width-mapping rules defined
in <xref target='RFC5892'/>.</t>
<t><list style='empty'><t>Informational Note: The order in which
the rules are applied for IDNA2008 (see <xref target='RFC5892'/>
and <xref target='RFC5895'/>) is different from the order for
localparts and resourceparts as described under
Sections <xref target='addressing-localpart' format="counter"/>
and <xref target='addressing-resourcepart' format="counter"/>.
</t></list></t>
</section>
<section title="Comparison" anchor="addressing-domainpart-comp">
<t>An entity that performs comparison of two strings before or after
their inclusion in XMPP domainpart slots MUST prepare each string
as specified in <xref target="addressing-domainpart-prep"/> and then
enforce the normalization, case&nbhy;mapping, and width-mapping rules
specified in <xref target="addressing-domainpart-enforce"/>.
The two strings are to be considered equivalent if they are an exact
octet-for-octet match (sometimes called "bit-string identity").</t>
</section>
</section>
<section title='Localpart' anchor='addressing-localpart'>
<t>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 <xref
target='XEP-0045'/>). The entity represented by an XMPP localpart is
addressed within the context of a specific domain (i.e.,
<localpart@domainpart>).</t>
<t>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.</t>
<t>The localpart of a JID is an instance of the UsernameCaseMapped
profile of the PRECIS IdentifierClass, which is specified in <xref
target='RFC7613'/>. The rules and considerations provided in that
specification MUST be applied to XMPP localparts.</t>
<t><list style='empty'><t>Implementation Note: XMPP uses the Simple
Authentication and Security Layer (SASL) <xref target='RFC4422'/> for
authentication. At the time of this writing, some SASL mechanisms use
SASLprep <xref target='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 <xref
target='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 <xref target='RFC7613'/>.</t></list></t>
<section title="Further Excluded Characters" anchor="addressing-localpart-excluded">
<t>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:
<list style='hanging'>
<t>" U+0022 (QUOTATION MARK)</t>
<t>& U+0026 (AMPERSAND)</t>
<t>' U+0027 (APOSTROPHE)</t>
<t>/ U+002F (SOLIDUS)</t>
<t>: U+003A (COLON)</t>
<t>< U+003C (LESS-THAN SIGN)</t>
<t>> U+003E (GREATER-THAN SIGN)</t>
<t>@ U+0040 (COMMERCIAL AT)</t>
</list>
</t>
<t><list style='empty'><t>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 <xref
target='XEP-0106'/>.</t></list></t>
</section>
</section>
<section title="Resourcepart" anchor="addressing-resourcepart">
<t>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 <xref target='XEP-0045'/>)
belonging to the entity associated with an XMPP localpart at a domain
(i.e., <localpart@domainpart/resourcepart>).</t>
<t>XMPP entities SHOULD consider resourceparts to be opaque strings and
SHOULD NOT impute meaning to any given resourcepart. In particular:</t>
<t>
<list style='symbols'>
<t>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
<xref target='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".</t>
<t>The '@' character is allowed in the resourcepart and is often
used in the "handle" shown in XMPP chatrooms <xref
target='XEP-0045'/>. For example, the JID
<[email protected]/user@host> describes an entity who is
an occupant of the room <[email protected]> with a handle
of <user@host>. However, chatroom services do not necessarily
check such an asserted handle against the occupant's real JID.</t>
</list>
</t>
<t>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.</t>
<t>The resourcepart of a JID is an instance of the OpaqueString profile
of the PRECIS FreeformClass, which is specified in
<xref target='RFC7613'/>. The rules and considerations provided in
that specification MUST be applied to XMPP resourceparts.</t>
<section title="Applicability to XMPP Extensions" anchor="addressing-resourcepart-applicability">
<t>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 <xref
target='XEP-0045'/> it might be appropriate to apply the rules
specified in <xref target='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.</t>
</section>
</section>
<section title="Examples" anchor="addressing-examples">
<t>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).</t>
<figure align="center">
<artwork align="center"><![CDATA[
+----------------------------------+-------------------------------+
| # | JID | Notes |
+----------------------------------+-------------------------------+
| 1 | <[email protected]> | A "bare JID" |
+----------------------------------+-------------------------------+
| 2 | <[email protected]/foo> | A "full JID" |
+----------------------------------+-------------------------------+
| 3 | <[email protected]/foo bar> | Single space in resourcepart |
+----------------------------------+-------------------------------+
| 4 | <[email protected]/foo@bar> | "At" sign in resourcepart |
+----------------------------------+-------------------------------+
| 5 | <foo\[email protected]> | Single space in localpart, as |
| | | optionally escaped using the |
| | | XMPP JID Escaping extension |
+----------------------------------+-------------------------------+
| 6 | <[email protected]> | Another bare JID |
+----------------------------------+-------------------------------+
| 7 | <fuß[email protected]> | 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| <[email protected]/♚>; | 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/[email protected]>| A domainpart followed by a |
| | | resourcepart that contains an |
| | | "at" sign |
+----------------------------------+-------------------------------+
]]></artwork>
<postamble>Table 1: A Sample of Legal JIDs</postamble>
</figure>
<t>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 <xref target='addressing-domainpart'/>.</t>
<t>The following examples illustrate strings that are not JIDs because
they violate the format defined above.</t>
<figure align="center">
<artwork align="center"><![CDATA[
+----------------------------------+-------------------------------+
| # | Non-JID string | Notes |
+----------------------------------+-------------------------------+
| 16| <"juliet"@example.com> | Quotation marks (U+0022) in |
| | | localpart |
+----------------------------------+-------------------------------+
| 17| <foo [email protected]> | Space (U+0020) in localpart |
+----------------------------------+-------------------------------+
| 18| <[email protected]/ 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 |
+----------------------------------+-------------------------------+
]]></artwork>
<postamble>Table 2: A Sample of Strings That Violate the JID Rules</postamble>
</figure>
<t>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 <xref target='XEP-0106'/>, as
illustrated by example 5 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 IdentifierClass. 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 FreeformClass 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.</t>
</section>
</section>
<section title="Enforcement in JIDs and JID Parts" anchor="enforcement">
<t>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 <xref target='RFC6120'/>).</t>
<t>Entities that enforce the rules specified in this document are
encouraged to be liberal in what they accept by following this
procedure:</t>
<t>
<list style='numbers'>
<t>Where possible, map characters (e.g., through width mapping,
additional mapping, special mapping, case mapping, or normalization)
and accept the mapped string.</t>
<t>If mapping is not possible (e.g., because a character is disallowed
in the FreeformClass), reject the string and return a
<jid-malformed/> error.</t>
</list>
</t>
<t>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 as defined in Section 2.3.2.6 of <xref
target='RFC5890'/>):</t>
<t>
<list style='hanging'>
<t hangText="JID Slot:">An XML element or attribute explicitly
designated in XMPP or in XMPP extensions for carrying a complete
JID.</t>
<t hangText="Localpart Slot:">An XML element or attribute explicitly
designated in XMPP or in XMPP extensions for carrying the localpart of
a JID.</t>
<t hangText="Resourcepart Slot:">An XML element or attribute
explicitly designated in XMPP or in XMPP extensions for carrying the
resourcepart of a JID.</t>
</list>
</t>
<t>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 <xref target='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 <xref target='RFC6121'/> is the 'jid'
attribute of the roster <item/> element.</t>
<t>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 <xref target='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 <xref
target='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.</t>
<t>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:</t>
<t>
<list style='symbols'>
<t>The 'from' and 'to' stream attributes and the 'from' and 'to'
stanza attributes <xref target='RFC6120'/>.</t>
<t>The 'jid' attribute of the roster <item/> element for contact
list management <xref target='RFC6121'/>.</t>
<t>The 'value' attribute of the <item/> element for Privacy
Lists <xref target='RFC3921'/> <xref target='XEP-0016'/> when the
value of the 'type' attribute is "jid".</t>
<t>The 'jid' attribute of the <item/> element for Service
Discovery defined in <xref target='XEP-0030'/>.</t>
<t>The <value/> element for Data Forms <xref
target='XEP-0004'/> when the 'type' attribute is "jid-single" or
"jid-multi".</t>
<t>The 'jid' attribute of the <conference/> element for Bookmark
Storage <xref target='XEP-0048'/>.</t>
<t>The <JABBERID/> of the <vCard/> element for vCard 3.0
<xref target='XEP-0054'/> and the <uri/> child of the
<impp/> element for vCard 4.0 <xref target='XEP-0292'/> when the
XML character data identifies an XMPP URI <xref
target='RFC5122'/>.</t>
<t>The 'from' attribute of the <delay/> element for Delayed
Delivery <xref target='XEP-0203'/>.</t>
<t>The 'jid' attribute of the <item/> element for the Blocking
Command <xref target='XEP-0191'/>.</t>
<t>The 'from' and 'to' attributes of the <result/> and
<verify/> elements for Server Dialback
<xref target='XEP-0220'/>.</t>
<t>The 'from' and 'to' attributes of the <iq/>,
<message/>, and <presence/> elements for the Jabber
Component Protocol <xref target='XEP-0114'/>.</t>
</list>
</t>
<t>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 <xref target='XEP-0030'/>, Multi-User Chat <xref
target='XEP-0045'/>, Publish-Subscribe <xref target='XEP-0060'/>, SOCKS5
Bytestreams <xref target='XEP-0065'/>, In-Band Registration <xref
target='XEP-0077'/>, Roster Item Exchange <xref target='XEP-0144'/>, and
Jingle <xref target='XEP-0166'/>.</t>
</section>
<section title="Internationalization Considerations" anchor="i18n">
<t>XMPP applications MUST support IDNA2008 for domainparts as described
under <xref target='addressing-domainpart'/>, the UsernameCaseMapped
profile for localparts as described under <xref
target='addressing-localpart'/>, and the OpaqueString profile for
resourceparts as described under <xref target='addressing-resourcepart'/>.
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 <xref target='RFC6120'/> and specifications for various
XMPP extensions.</t>
<t><list style='empty'><t>Interoperability Note: For backward
compatibility, many existing XMPP implementations and deployments support
IDNA2003 <xref target='RFC3490'/> for domainparts, and the stringprep
<xref target='RFC3454'/> profiles Nodeprep and Resourceprep <xref
target='RFC3920'/> for localparts and resourceparts.</t></list></t>
</section>
<section title="IANA Considerations" anchor="iana">
<section title="Stringprep Profiles Registry" anchor="iana-stringprep">
<t>The stringprep specification <xref target='RFC3454'/> did not provide
for 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 has marked those profiles as "Not Current"
and cited this document as an additional reference.</t>
</section>
</section>
<section title="Security Considerations" anchor="security">
<section title="Reuse of PRECIS" anchor="security-PRECIS">
<t>The security considerations described in <xref target="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 <xref target="RFC5890"/> apply
to internationalized domain names, which are used here for XMPP
domainparts.</t>
</section>
<section title="Reuse of Unicode" anchor="security-unicode">
<t>The security considerations described in <xref target='UTS39'/> apply
to the use of Unicode characters in XMPP addresses.</t>
</section>
<section title="Address Spoofing" anchor="security-spoofing">
<t>There are two forms of address spoofing: forging and mimicking.</t>
<section title="Address Forging" anchor="security-forging">
<t>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 <xref target='RFC4422'/> as
described in <xref target='RFC6120'/>). For example, address forging
occurs if an entity that authenticated as "[email protected]" is
able to send XML stanzas from "[email protected]" or
"[email protected]".</t>
<t>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 <xref target='RFC6120'/>). However, address forging is possible
if:</t>
<t>
<list style='symbols'>
<t>A poorly implemented server ignores the requirement for
stamping the 'from' address. This would enable any entity that
authenticated with the server to send stanzas from any
localpart@domainpart as long as the domainpart matches the sending
domain of the server.</t>
<t>An actively malicious server generates stanzas on behalf of any
registered account at the domain or domains hosted at that
server.</t>
</list>
</t>
<t>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, because it would require the rogue
server to generate false credentials for signing or encryption of each
stanza, in addition to modifying 'from' addresses.</t>
</section>
<section title="Address Mimicking" anchor="security-mimicking">
<t>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).</t>
<t>As explained in <xref target='RFC5890'/>, <xref target='RFC7564'/>,
<xref target='UTR36'/>, and <xref target='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:</t>
<t>
<list style='symbols'>
<t>A domainpart is always employed as one part of an entity's
address in XMPP. One common usage is as the address of a server
or server-side service, such as a multi-user chat service <xref
target='XEP-0045'/>. The security of such services could be
compromised based on different interpretations of the
internationalized domainpart; for example, a user might authorize
a malicious entity at a fake server to view the user's presence
information, or a user could join chatrooms at a fake multi-user
chat service.</t>
<t>A localpart can be employed as one part of an entity's address
in XMPP. One common usage is as the username of an instant
messaging user; another is as the name of a multi-user chatroom;
and many other kinds of entities could use localparts as part of
their addresses. The security of such services could be
compromised based on different interpretations of the
internationalized localpart; for example, a user entering a single
internationalized localpart could access another user's account
information, or a user could gain access to a hidden or otherwise
restricted chatroom or service.</t>
<t>A resourcepart can be employed as one part of an entity's
address in XMPP. One common usage is as the name for an instant
messaging user's connected resource; another is as the nickname of
a user in a multi-user chatroom; and many other kinds of entities
could use resourceparts as part of their addresses. The security
of such services could be compromised based on different
interpretations of the internationalized resourcepart; for
example, two or more confusable resources could be bound at the
same time to the same account (resulting in inconsistent
authorization decisions in an XMPP application that uses full
JIDs), or a user could send a private message to someone other
than the intended recipient in a multi-user chatroom.</t>
</list>
</t>
<t>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 <xref
target='RFC7564'/>.</t>
</section>
</section>
</section>
<section title="Conformance Requirements" anchor="conformance">
<t>This section describes a protocol feature set that summarizes the
conformance requirements of this specification (similar feature sets are
provided for XMPP in <xref target='RFC6120'/> and <xref
target='RFC6121'/>). The summary is purely informational, and the
conformance keywords of <xref target='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:</t>
<t>
<list style='symbols'>
<t>A human-readable name</t>
<t>An informational description</t>
<t>A reference to the particular section of this document that
normatively defines the feature</t>
<t>Whether the feature applies to the client role, the server role, or
both (where "N/A" signifies that the feature is not applicable to the
specified role)</t>
<t>Whether the feature MUST or SHOULD be implemented, where the
capitalized terms are to be understood as described in <xref
target='RFC2119'/></t>
</list>
</t>
<t>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 <xref target='INTEROP'/>.</t>
<t>
<list style='hanging'>
<t hangText="Feature:">address-domain-length</t>
<t hangText="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.</t>
<t hangText="Section:"><xref target='addressing-domainpart'/></t>
<t hangText="Roles:">Server MUST, client SHOULD.</t>
</list>
</t>
<t>
<list style='hanging'>
<t hangText="Feature:">address-domain-prep</t>
<t hangText="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.</t>
<t hangText="Section:"><xref target='addressing-domainpart'/></t>
<t hangText="Roles:">Server MUST, client SHOULD.</t>
</list>
</t>
<t>
<list style='hanging'>
<t hangText="Feature:">address-localpart-length</t>
<t hangText="Description:">Ensure that the localpart of an XMPP
address is at least one octet in length and at most 1023 octets in
length.</t>
<t hangText="Section:"><xref target='addressing-localpart'/></t>
<t hangText="Roles:">Server MUST, client SHOULD.</t>
</list>
</t>
<t>
<list style='hanging'>
<t hangText="Feature:">address-localpart-prep</t>
<t hangText="Description:">Ensure that the localpart of an XMPP
address conforms to the UsernameCaseMapped profile of the PRECIS
IdentifierClass.</t>
<t hangText="Section:"><xref target='addressing-localpart'/></t>
<t hangText="Roles:">Server MUST, client SHOULD.</t>
</list>
</t>
<t>
<list style='hanging'>
<t hangText="Feature:">address-resource-length</t>
<t hangText="Description:">Ensure that the resourcepart of an XMPP
address is at least one octet in length and at most 1023 octets in
length.</t>
<t hangText="Section:"><xref target='addressing-resourcepart'/></t>
<t hangText="Roles:">Server MUST, client SHOULD.</t>
</list>
</t>
<t>
<list style='hanging'>
<t hangText="Feature:">address-resource-prep</t>
<t hangText="Description:">Ensure that the resourcepart of an XMPP
address conforms to the OpaqueString profile of the PRECIS
FreeformClass.</t>
<t hangText="Section:"><xref target='addressing-resourcepart'/>
</t>
<t hangText="Roles:">Server MUST, client SHOULD.</t>
</list>
</t>
</section>
</middle>
<back>
<references title="Normative References">
<?rfc include="reference.RFC.1034"?>
<?rfc include="reference.RFC.2119"?>
<?rfc include="reference.RFC.3629"?>
<?rfc include="reference.RFC.3986"?>
<?rfc include="reference.RFC.5234"?>
<?rfc include="reference.RFC.5890"?>
<?rfc include="reference.RFC.5892"?>
<?rfc include="reference.RFC.6120"?>
<?rfc include="reference.RFC.6365"?>
<?rfc include="reference.RFC.6874"?>
<?rfc include="reference.RFC.7564"?>
<?rfc include="reference.RFC.7613"?>
<reference anchor="Unicode" target="http://www.unicode.org/versions/latest/">
<front>
<title>The Unicode Standard</title>
<author>
<organization>The Unicode Consortium</organization>
</author>
<!-- <date year="2015-present" /> -->
<date/>
</front>
</reference>
<reference anchor="UTR36" target='http://www.unicode.org/reports/tr36/'>
<front>
<title>Unicode Security Considerations</title>
<author>
<organization>Unicode Technical Report #36</organization>
</author>
<!-- <date month="September" year="2014" /> -->
<date/>
</front>
<seriesInfo name='edited by Mark Davis' value='and Michel Suignard'/>
</reference>
</references>
<references title="Informative References">
<!-- draft-ietf-precis-nickname (IESG Eval.) -->
<reference anchor='PRECIS-Nickname'>
<front>
<title>Preparation, Enforcement, and Comparison of Internationalized Strings
Representing Nicknames</title>
<author initials='P' surname='Saint-Andre' fullname='Peter Saint-Andre'>
<organization />
</author>
<date month='June' year='2015' />
</front>
<seriesInfo name='Work in Progress,' value='draft-ietf-precis-nickname-18' />
</reference>
<!-- draft-ietf-newtrk-interop-reports (Expired) -->
<reference anchor='INTEROP'>
<front>
<title>Formalizing IETF Interoperability Reporting</title>
<author initials='L' surname='Masinter' fullname='Larry Masinter'>
<organization />
</author>
<date month='October' year='2005' />
</front>
<seriesInfo name='Work in Progress,' value='draft-ietf-newtrk-interop-reports-00' />
</reference>
<?rfc include="reference.RFC.1123"?>
<?rfc include="reference.RFC.1535"?>
<?rfc include="reference.RFC.3454"?>
<?rfc include="reference.RFC.3490"?>
<?rfc include="reference.RFC.3920"?>
<?rfc include="reference.RFC.3921"?>
<?rfc include="reference.RFC.3987"?>
<?rfc include="reference.RFC.4013"?>
<?rfc include="reference.RFC.4422"?>
<?rfc include="reference.RFC.5122"?>