RFC 8266

Preparation, Enforcement, and Comparison of Internationalized Strings Representing Nicknames

πŸ“… published October 2017, from ietf

Preparation, Enforcement, and Comparison of Internationalized Strings Representing Nicknames πŸŽ€

  • Series: Internet Engineering Task Force (IETF) πŸ’–
  • Request for Comments: 8266 πŸ¦‹
  • Written by: P. Saint-Andre, Jabber.org ✨
  • Date: October 2017 πŸ“…
  • Category: Standards Track πŸ”₯
  • Obsoletes: 7700 πŸ’…
  • ISSN: 2070-1721 🌈

Abstract 🌸

Okay bestie, this doc is all about Unicode strings that act as memorable, human-friendly names. We're talking "nicknames", "display names", or "petnames" for people, devices, accounts, websites, and literally anything else 🧚 It also obsoletes RFC 7700, so this is the new hotness πŸ’…

Status of This Memo πŸ“œ

This is an Internet Standards Track document. ✨

It's a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community, got public review, and was approved for publication by the Internet Engineering Steering Group (IESG). For more on Internet Standards, check out Section 2 of RFC 7841 🫢

For the current status, any errata, and how to give feedback, go to https://www.rfc-editor.org/info/rfc8266 πŸ’œ

Copyright (c) 2017 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 (https://trustee.ietf.org/license-info) as in effect on the date of publication. Please read these carefully, because they spell out your rights and restrictions for this document πŸ™ˆ Code Components pulled from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions, and they come without warranty as described in the Simplified BSD License πŸ’…

Table of Contents πŸ“

Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
     1.1.  Overview  . . . . . . . . . . . . . . . . . . . . . . . .   2
     1.2.  Terminology . . . . . . . . . . . . . . . . . . . . . . .   3
   2.  Nickname Profile  . . . . . . . . . . . . . . . . . . . . . .   4
     2.1.  Rules . . . . . . . . . . . . . . . . . . . . . . . . . .   4
     2.2.  Preparation . . . . . . . . . . . . . . . . . . . . . . .   5
     2.3.  Enforcement . . . . . . . . . . . . . . . . . . . . . . .   5
     2.4.  Comparison  . . . . . . . . . . . . . . . . . . . . . . .   6
   3.  Examples  . . . . . . . . . . . . . . . . . . . . . . . . . .   6
   4.  Use in Application Protocols  . . . . . . . . . . . . . . . .   8
   5.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .   9
   6.  Security Considerations . . . . . . . . . . . . . . . . . . .   9
     6.1.  Authentication and Authorization  . . . . . . . . . . . .   9
     6.2.  Reuse of PRECIS . . . . . . . . . . . . . . . . . . . . .  10
     6.3.  Reuse of Unicode  . . . . . . . . . . . . . . . . . . . .  10
     6.4.  Visually Similar Characters . . . . . . . . . . . . . . .  10
   7.  References  . . . . . . . . . . . . . . . . . . . . . . . . .  10
     7.1.  Normative References  . . . . . . . . . . . . . . . . . .  10
     7.2.  Informative References  . . . . . . . . . . . . . . . . .  11
   Appendix A.  Changes from RFC 7700  . . . . . . . . . . . . . . .  12
   Acknowledgements  . . . . . . . . . . . . . . . . . . . . . . . .  12
   Author's Address  . . . . . . . . . . . . . . . . . . . . . . . .  13

1. Introduction ✨

1.1. Overview πŸ’–

Okay so a bunch of technologies let a person pick a memorable, human-friendly name for a chat, or set one for something else like a device, account, contact, or website πŸ¦‹ These get called "nicknames" (in chat rooms), "display names" (in Internet mail), or "petnames" (see [PETNAME-SYSTEMS]). This doc just calls them all "nicknames" for consistency 🫢

Nicknames show up in textual chat room tech like:

  • Internet Relay Chat (IRC) [RFC2811]
  • The Message Session Relay Protocol (MSRP) [RFC4975] [RFC7701]
  • Centralized Conferencing (XCON) [RFC5239] [XCON-SYSTEM]
  • The Extensible Messaging and Presence Protocol (XMPP) [RFC6120] [XEP-0045]

Newer chat tech lets nicknames be internationalized too, since they can use code points from outside the ASCII range [RFC20], usually via the Unicode coded character set [Unicode]. Even though these nicknames are mostly for display, sometimes apps use them programmatically too, like kicking someone out of a chat room or avoiding nickname clashes πŸ‘‘

A similar vibe applies when someone sets their own preferred display name or sets one for another user. Examples are the "display-name" construct in the Internet message format [RFC5322] and the <nick/> element in XMPP [XEP-0172] πŸ’…

Memorable names pop up outside of personal messaging too: device names in a network visualization app, website names for bookmarks in a web browser, account names for a list of payees in a bank account, people names in a contact list app, and so on 🌸

The rules in this document work in all of those contexts ✨

Here's the big thing to understand: a nickname is a personally memorable name or handle for something with a more stable, underlying identity, like a URI or a file path 🧚 To keep apps that use nicknames secure, authentication and authorization decisions MUST be made on the basis of the thing's identity, not its nickname. No cap, this is the most important line in the whole intro πŸ”₯

To make memorable names work sensibly for typical users all over the world, this document sets rules for handling nicknames through the preparation, enforcement, and comparison of internationalized strings (PRECIS) framework specification [RFC8264] 🌈

1.2. Terminology πŸ“–

Lots of the important terms here are defined in [RFC8264], [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 BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here. πŸŽ€


2. Nickname Profile πŸ“

2.1. Rules πŸ‘‘

These rules apply within the Nickname profile of the PRECIS FreeformClass defined in the PRECIS framework specification [RFC8264] πŸ’–

  1. Width Mapping Rule: There is no width mapping rule. (Such a rule is not necessary because width mapping happens as part of normalization using Normalization Form KC (NFKC), as specified below.) 🌸
  2. Additional Mapping Rule: This rule has the following sub-rules. ✨
    • a. Map any instances of non-ASCII space to SPACE (U+0020). A non-ASCII space is any Unicode code point with a general category of Zs, except SPACE (U+0020) itself. (Only allowing ASCII space avoids confusion with the many non-ASCII space code points that are hard to type across different input methods πŸ™ˆ)
    • b. Remove any ASCII space at the beginning or end of a nickname. For example, "stpeter " is mapped to "stpeter" πŸ’…
    • c. Map any interior run of more than one ASCII space down to a single ASCII space. For example, "St Peter" is mapped to "St Peter" πŸ¦‹
  3. Case Mapping Rule: Apply the Unicode toLowerCase() operation, as defined in the Unicode Standard [Unicode]. In apps that ban conflicting nicknames, this helps avoid confusion by making sure nicknames that differ only by case (like "stpeter" vs. "StPeter") wouldn't show up to a human user at the same time. (As explained below, this is typically appropriate only for comparison, not for enforcement.) 🧚
  4. Normalization Rule: Apply Unicode Normalization Form KC. NFKC is more "aggressive" at finding matches than other normalization forms. In Unicode terms, it does both canonical and compatibility decomposition before recomposing code points, so this rule cuts down on confusion by increasing the number of code points that match. For example, the character β…£ (ROMAN NUMERAL FOUR, U+2163) would match the combination of I (LATIN CAPITAL LETTER I, U+0049) and V (LATIN CAPITAL LETTER V, U+0056) πŸ”₯
  5. Directionality Rule: There is no directionality rule. The "Bidi Rule" (defined in [RFC5893]) and similar rules are unnecessary and don't apply to nicknames. It's perfectly fine for a nickname to be shown differently in different layout systems (for example, a UI set up mainly for a right-to-left script versus one set up mainly for a left-to-right script), as long as it looks consistent within any given layout system 🌈

Plot twist 😭 Applying the Nickname profile rules isn't idempotent for every code point, which means running them once isn't always enough. So an implementation SHOULD apply the rules repeatedly until the output string is stable. If the output still hasn't stabilized after three (3) more rounds past the first application, the implementation SHOULD stop applying the rules and reject the input string as invalid. Bestie, that's a whole cutoff system πŸ’€

2.2. Preparation 🌸

An entity that prepares an input string for later enforcement under this profile MUST make sure the string only has Unicode code points that conform to the FreeformClass string class defined in [RFC8264] ✨

2.3. Enforcement πŸ’…

An entity that does enforcement under this profile MUST prepare an input string as described in Section 2.2, and it MUST also apply the following rules from Section 2.1, in the order shown: 🫢

  1. Additional Mapping Rule
  2. Normalization Rule

Note: An entity SHOULD apply the Case Mapping Rule only during comparison. πŸ‘‘

After all of the rules above have been enforced, the entity MUST make sure the nickname is not zero bytes in length. This check happens after the rules so apps don't accidentally drop a nickname entirely. When internationalized strings are accepted, a non-empty sequence of characters can turn into a zero-length nickname after canonicalization, and that's the sneaky case this catches πŸ™ˆ

The result of all those operations is an output string that conforms to the Nickname profile. Until an implementation produces such an output string, it MUST NOT treat the string as conforming. In particular, it MUST NOT assume that an input string is conforming before the enforcement operation has been completed. Don't skip ahead, bestie 🌈

2.4. Comparison

okay bestie, comparison time πŸ’… any entity comparing two strings under this profile MUST prepare each input string the way Section 2.2 says, and then MUST apply the Section 2.1 rules in this exact order:

  1. Additional Mapping Rule
  2. Case Mapping Rule
  3. Normalization Rule

the two strings only count as equivalent if they're an exact octet-for-octet match (aka "bit-string identity") 🫢

and here's the vibe check: until an implementation has actually worked out whether two strings are equivalent, it MUST NOT treat them as equivalent πŸ™ˆ like, it MUST NOT assume two inputs match before the comparison is totally finished ✨


3. Examples ✨

these are a few nicknames that fit the format above, plus the output you get after the PRECIS rules are applied for comparison πŸ’– (heads up: the "<" and ">" just outline the nickname so you can see it, they're not part of the actual string 🌸)

    +---------------------------+-------------------------------------+
    | #  | Nickname             | Output for Comparison               |
    +---------------------------+-------------------------------------+
    | 1  | <Foo>                | <foo>                               |
    +---------------------------+-------------------------------------+
    | 2  | <foo>                | <foo>                               |
    +---------------------------+-------------------------------------+
    | 3  | <Foo Bar>            | <foo bar>                           |
    +---------------------------+-------------------------------------+
    | 4  | <foo bar>            | <foo bar>                           |
    +---------------------------+-------------------------------------+
    | 5  | <Ξ£>                  | Οƒ (GREEK SMALL LETTER SIGMA,        |
    |    |                      | U+03C3)                             |
    +---------------------------+-------------------------------------+
    | 6  | <Οƒ>                  | Οƒ (GREEK SMALL LETTER SIGMA,        |
    |    |                      | U+03C3)                             |
    +---------------------------+-------------------------------------+
    | 7  | <Ο‚>                  | Ο‚ (GREEK SMALL LETTER FINAL SIGMA,  |
    |    |                      | U+03C2)                             |
    +---------------------------+-------------------------------------+
    | 8  | <Ο”>                  | Ο‹ (GREEK SMALL LETTER UPSILON       |
    |    |                      | WITH DIALYTIKA, U+03CB)             |
    +---------------------------+-------------------------------------+
    | 9  | <∞>                  | ∞ (INFINITY, U+221E)                |
    +---------------------------+-------------------------------------+
    | 10 | <Richard β…£>         | <richard iv>                        |
    +---------------------------+-------------------------------------+

                   Table 1: A Sample of Legal Nicknames

okay so for examples 5, 6, and 7 πŸ”€ applying the Unicode toLowerCase() operation to "Ξ£" (GREEK CAPITAL LETTER SIGMA, U+03A3) gives you "Οƒ" (GREEK SMALL LETTER SIGMA, U+03C3), BUT toLowerCase() leaves "Ο‚" (GREEK SMALL LETTER FINAL SIGMA, U+03C2) totally alone 😭 so the comparison operation from Section 2.4 matches examples 5 and 6, but it does NOT match 5 and 7, or 6 and 7. plot twist, the sigmas are not all the same πŸ’€

example 8 is a serious main character moment πŸ‘‘ applying these rules is NOT an idempotent procedure here (see Section 2.1), which means running it again can change things. specifically:

  1. toLowerCase() on "Ο”" (GREEK UPSILON WITH DIARESIS AND HOOK SYMBOL, U+03D4) does nothing, but NFKC on that same character gives you "Ξ«" (GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA, U+03AB).
  2. toLowerCase() on "Ξ«" (GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA, U+03AB) gives you "Ο‹" (GREEK SMALL LETTER UPSILON WITH DIALYTIKA, U+03CB), and NFKC on that one does nothing.

example 9 is giving symbols 🌈 "∞" (INFINITY, U+221E) is allowed by the PRECIS FreeformClass, so yes, you can use it in a nickname ♾️

and example 10 is a whole mood 🧚 toLowerCase() on "β…£" (ROMAN NUMERAL FOUR, U+2163) gives you "β…³" (SMALL ROMAN NUMERAL FOUR, U+2173), and then NFKC on "β…³" turns it into the two characters "i" (LATIN SMALL LETTER I, U+0069) and "v" (LATIN SMALL LETTER V, U+0076) πŸŽ€


4. Use in Application Protocols πŸ¦‹

okay so this spec ONLY defines the PRECIS-based rules for handling nickname strings πŸ’… it's up to an application protocol (for example MSRP, XCON, or XMPP) or an application definition to decide which protocol slots can hold nickname strings, which entities are expected to enforce the nickname rules, and when during protocol processing or interface handling those rules get enforced. for tips on using PRECIS profiles in apps, check Section 6 of [RFC8264] πŸ“š

on top of the PRECIS rules here, application protocols can add their own rules for nicknames too 🌸 think minimum or maximum length, extra restrictions on allowed code points or character ranges, safeguards against visually similar characters, and so on.

application protocols can also set rules for how nicknames actually get used in apps πŸ’– things like reserved nicknames, authorization requirements for using a nickname, whether certain nicknames can be banned, how duplicates are handled, and how nicknames relate to underlying identifiers such as SIP URIs or Jabber IDs.

entities that enforce the rules in this document are encouraged to be liberal in what they accept 🫢 by following this procedure:

  1. Where possible, map characters (for example through width mapping, additional mapping, case mapping, or normalization) and accept the mapped string.
  2. If mapping isn't possible (for example, because a character is disallowed in the FreeformClass), reject the string.

5. IANA Considerations πŸ“

IANA has added the following entry to the "PRECIS Profiles" registry πŸ’…

   Name:  Nickname.

   Base Class:  FreeformClass.

   Applicability:  Nicknames or display names in messaging and text
      conferencing technologies; petnames for devices, accounts, and
      people; and other uses of nicknames, display names, or petnames.

   Replaces:  None.

   Width Mapping Rule:  None (handled via NFKC).

   Additional Mapping Rule:  Map non-ASCII space characters to SPACE
      (U+0020), strip leading and trailing space characters, and map
      interior sequences of multiple space characters to a single
      instance of SPACE (U+0020).

   Case Mapping Rule:  Map uppercase and titlecase code points to
      lowercase using the Unicode toLowerCase() operation.

   Normalization Rule:  NFKC.

   Directionality Rule:  None.

   Enforcement:  To be specified by applications.

   Specification:  RFC 8266.

6. Security Considerations πŸ”

6.1. Authentication and Authorization

🚨 this one is serious, bestie. a nickname is a personally memorable name or handle for something with a more stable, underlying identity (like a URI or a file path). so to keep apps secure, authentication and authorization decisions MUST be made based on the thing's identity, NOT its nickname πŸ™…β€β™€οΈ

6.2. Reuse of PRECIS

the security considerations in [RFC8264] also apply to the FreeformClass string class this document uses for nicknames πŸ›‘οΈ

6.3. Reuse of Unicode

the security considerations in [UTS39] apply to the use of Unicode code points in nicknames 🌐

6.4. Visually Similar Characters

[RFC8264] covers some of the security considerations around visually similar characters (also called "confusable characters" or "confusables") and gives some examples of them πŸ‘€

the mapping rules in Section 2 of this document are designed, in part, to cut down on confusion about nicknames πŸ’… but this document does NOT give more detailed guidance on handling visually similar characters, like the kind found in [UTS39] πŸ™ˆ


7. References πŸ“š

7.1. Normative References

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

   [RFC5893]  Alvestrand, H., Ed. and C. Karp, "Right-to-Left Scripts
              for Internationalized Domain Names for Applications
              (IDNA)", RFC 5893, DOI 10.17487/RFC5893, August 2010,
              <https://www.rfc-editor.org/info/rfc5893>.

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

   [RFC8174]  Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
              2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
              May 2017, <https://www.rfc-editor.org/info/rfc8174>.

   [RFC8264]  Saint-Andre, P. and M. Blanchet, "PRECIS Framework:
              Preparation, Enforcement, and Comparison of
              Internationalized Strings in Application Protocols",
              RFC 8264, DOI 10.17487/RFC8264, October 2017,
              <https://www.rfc-editor.org/info/rfc8264>.

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

   [UTS39]    Unicode Technical Standard #39, "Unicode Security
              Mechanisms", edited by Mark Davis and Michel Suignard,
              <http://unicode.org/reports/tr39/>.

7.2. Informative References ✨

okay bestie, here's the optional reading list πŸ“š these aren't needed to implement the spec, but they give you the whole backstory πŸ¦‹


Appendix A. Changes from RFC 7700 πŸ’…

okay so here's the glow-up log, the changes made from [RFC7700] 🌈

  • Addressed [Err4570] by removing the directionality rule from Sections 2.3 and 2.4. no more directionality rule, periodt πŸ’–
  • In accordance with working group discussions and updates to [RFC8264], removed the use of the Unicode toCaseFold() operation in favor of the Unicode toLowerCase() operation. ✨
  • Clarified several editorial matters. πŸ¦‹
  • Updated references. πŸ“š

Acknowledgements 🫢

Huge thanks to William Fisher for his implementation feedback, especially regarding idempotence. the implementer energy is unmatched πŸ”₯

Thanks to Sam Whited for his feedback and for submitting [Err4570]. πŸ’œ

See [RFC7700] for acknowledgements related to the specification that this document supersedes. go check that one too, it's giving history 🌸


Author's Address πŸŽ€

Peter Saint-Andre
Jabber.org
P.O. Box 787
Parker, CO  80134
United States of America

Phone: +1 720 256 6756
Email: stpeter@jabber.org
URI:   https://www.jabber.org/
πŸ“¦ where this page comes from