Subject: Re: [precis] Review of current document draft-ietf-precis-framework-20

From: Peter Saint-Andre - &yet <[email-masked]>
Date: Tue, 02 Dec 2014 20:04:48 -0700

Hi Patrik,

On 11/26/14, 11:28 PM, Patrik Fältström wrote:
> I intend reading the mapping document today, sorry for the delay but
> $dayjob has been kind of ultra-busy...
>
> Note that most issues I have have to do with clarifications, and that
> it is not clear what the intent is.

Yes, I will reply to your big message next.

> Maybe a few where I urge caution. And they are definitely mapping
> related.

Clarifying question: are you talking about mapping in general (which 
might include width mapping, mapping non-ASCII space characters to ASCII 
space, case mapping, or in some nomenclatures even Unicode 
normalization), or only the kind of locale and context dependent mapping 
that is discussed in draft-ietf-precis-mappings?

> Let me phrase it this way:
>
> One of the problems with IDNA2003 was that it included mapping. It
> was unclear to people whether the client or server did the mapping.
> In reality the only place where mapping could exist for a stable
> protocol/implementation was between application/User Interface and
> where the protocol was really "doing things". So mapping was ripped
> out of IDNA when IDNA2008 was created.

In the PRECIS WG we've had quite a bit of discussion about the dividing 
line between application and protocol, or more precisely between between 
the user interface (which can more easily handle issues of culture, 
context, intent, locale, device limitations, etc.) and the actual use of 
conformant strings in protocol slots.

(Unfortunately, much of our most productive discussion has happened in 
sessions at IETF meetings, not on the list, so it's hard to find pointers.)

> Precis has decided mapping is still part of the protocol definition,

Well, draft-ietf-precis-mappings is only an informative reference from 
draft-ietf-precis-framework and with good reason: we reached the 
conclusion a few IETF meetings ago that we simply couldn't provide 
normative recommendations here.

> and I must understand where more exactly you expect mapping to
> happen, what happens if that mapping is not done, how to expect to do
> matching (comparison) between strings in the over all environment
> where it is possibly unknown whether mapping has been done or not,
> and specifically how it might impact the architecture in the cases
> where the mapping is destructive to the string itself (non-reversible
> mapping).
>
> I do not think it is clear in the framework WHERE mapping is to
> happen.

When you say "WHERE", do you mean (1) when in the process of handling an 
internationalized string or (2) by which entity in a protocol interaction?

I think we have been clear about (1), or at least we've tried to be 
clear - see for example Section 6 of draft-ietf-precis-framework.

I also think that the various profile documents and using protocols have 
been clear about (2) - see for instance Section 4 of 
draft-ietf-xmpp-6122bis.

> Maybe just some ascii art would make things easier to understand?

ASCII art always helps. :-)

Peter

-- 
Peter Saint-Andre
https://andyet.com/

---

From: Patrik Fältström <[email-masked]>
Date: Wed, 3 Dec 2014 06:24:57 +0100

On 3 dec 2014, at 04:04, Peter Saint-Andre - &yet <[email-masked]> wrote:
> Clarifying question: are you talking about mapping in general (which might include width mapping, mapping non-ASCII space characters to ASCII space, case mapping, or in some nomenclatures even Unicode normalization), or only the kind of locale and context dependent mapping that is discussed in draft-ietf-precis-mappings?

I talk about any kind of transformation of a string.

> In the PRECIS WG we've had quite a bit of discussion about the dividing line between application and protocol, or more precisely between between the user interface (which can more easily handle issues of culture, context, intent, locale, device limitations, etc.) and the actual use of conformant strings in protocol slots.

Not surprising (and yes, I have seen some of this without claiming I did follow it).

> (Unfortunately, much of our most productive discussion has happened in sessions at IETF meetings, not on the list, so it's hard to find pointers.)
> 
> Well, draft-ietf-precis-mappings is only an informative reference from draft-ietf-precis-framework and with good reason: we reached the conclusion a few IETF meetings ago that we simply couldn't provide normative recommendations here.

Ok. Which I think is fair and good.

> When you say "WHERE", do you mean (1) when in the process of handling an internationalized string or (2) by which entity in a protocol interaction?

Mainly (1) but that implies (2), right.

> I think we have been clear about (1), or at least we've tried to be clear - see for example Section 6 of draft-ietf-precis-framework.

That only specifies in what order the operations take place. It does not say when it happens.

Example:

A send a string X to B. B store the string, which can be a username or password.

Later C send a string Y to B. B is to look up that string among stored strings, to see whether in this case X == Y or not.

Where in the flow A -> B(store) - B(lookup) <- C are the steps in section 6 taking place?

You have some string flowing between A and B(store), some string stored, some string flowing between C and B(lookup) and then some string is looked up. Which ones of these strings passed around have to live up to what requirements?

> I also think that the various profile documents and using protocols have been clear about (2) - see for instance Section 4 of draft-ietf-xmpp-6122bis.
> 

:-D

   Patrik

---

From: Peter Saint-Andre - &yet <[email-masked]>
Date: Wed, 03 Dec 2014 20:06:14 -0700

> You have some string flowing between A and B(store), some string stored, some string flowing between C and B(lookup) and then some string is looked up. Which ones of these strings passed around hav…

Yes, that is very important, and we have tried to make that clear in 
application specs that are using PRECIS. For instance, 6122bis says:

    Enforcement entails applying all of the rules specified in this
    document.  Enforcement of the XMPP address format rules is the
    responsibility of XMPP servers.  Although XMPP clients SHOULD prepare
    complete JIDs and parts of JIDs in accordance with this document
    before including them in protocol slots within XML streams, XMPP
    servers MUST enforce the rules wherever possible and reject stanzas
    and other XML elements that violate the rules (for stanzas, by
    returning a <jid-malformed/> error to the sender as described in
    Section 8.3.3.8 of [RFC6120]).

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

    1.  Where possible, map characters (e.g, through width mapping,
        additional mapping, special mapping, case mapping, or
        normalization) and accept the mapped string.

    2.  If mapping is not possible (e.g., because a character is
        disallowed in the FreeformClass), reject the string and return a
        <jid-malformed/> error.

    Enforcement applies to complete JIDs and to parts of JIDs.  To
    facilitate implementation, this document defines the concepts of "JID
    slot", "localpart slot", and "resourcepart slot" (similar to the
    concept of a "domain name slot" for IDNA2008 defined in
    Section 2.3.2.6 of [RFC5890]):

    JID Slot:  An XML element or attribute explicitly designated in XMPP
       or in XMPP extensions for carrying a complete JID.

    Localpart Slot:  An XML element or attribute explicitly designated in
       XMPP or in XMPP extensions for carrying the localpart of a JID.

    Resourcepart Slot:  An XML element or attribute explicitly designated
       in XMPP or in XMPP extensions for carrying the resourcepart of a
       JID.

    A server is responsible for enforcing the address format rules when
    receiving protocol elements from clients where the server is expected
    to handle such elements directly or to use them for purposes of
    routing a stanza to another domain or delivering a stanza to a local
    entity; two examples from [RFC6120] are the 'to' attribute on XML
    stanzas (which is a JID slot used by XMPP servers for routing of
    outbound stanzas) and the <resource/> child of the <bind/> element
    (which is a resourcepart slot used by XMPP servers for binding of a
    resource to an account for routing of stanzas between the server and
    a particular client).  An example from [RFC6121] is the 'jid'
    attribute of the roster <item/> element.

    A server is not responsible for enforcing the rules when the protocol
    elements are intended for communication among other entities,
    typically within the payload of a stanza that the server is merely
    routing to another domain or delivering to a local entity.  Two
    examples are the 'initiator' attribute in the Jingle extension
    [XEP-0166] (which is a JID slot used for client-to-client
    coordination of multimedia sessions) and the 'nick' attribute in the
    Multi-User Chat extension [XEP-0045] (which is a resourcepart slot
    used for administrative purposes in the context of XMPP chatrooms).
    In such cases, clients 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.

Is that kind of text specific enough for you?

I think we need to define this at the level of the application protocol 
because that's where the rubber meets the road and where we can 
legitimately talk about the various entities involved (at the level of 
the PRECIS framework we don't know what the entities are and what their 
responsibilities are).

As another example, see this recent discussion in the PCP WG:

http://www.ietf.org/mail-archive/web/pcp/current/msg03819.html

Peter

-- 
Peter Saint-Andre
https://andyet.com/

---

From: Patrik Fältström <[email-masked]>
Date: Thu, 4 Dec 2014 09:00:23 +0100

> On 4 Dec 2014, at 04:06, Peter Saint-Andre - &yet <[email-masked]> wrote:
> 

Yes.

> I think we need to define this at the level of the application protocol because that's where the rubber meets the road and where we can legitimately talk about the various entities involved (at the level of the PRECIS framework we don't know what the entities are and what their responsibilities are).

I would say "ok" to the precis document if there is text added that say explicitly that that kind of text MUST be in an application specific document that reference the precis doc.

I.e. without text like that, it is very dangerous what is specified.

   Patrik

---

From: Peter Saint-Andre - &yet <[email-masked]>
Date: Sun, 07 Dec 2014 18:35:18 -0700

> I.e. without text like that, it is very dangerous what is specified.

Agreed. I'll add some text about that in the next version.

Peter

---

From: Peter Saint-Andre - &yet <[email-masked]>
Date: Sun, 07 Dec 2014 20:49:01 -0700

On 11/23/14, 7:58 AM, Patrik Fältström wrote:
> I have on request from the chairs done a review of three Precis
> documents. Here is the review of draft-ietf-precis-framework-20.

Patrik, many thanks for the thorough review!

> The review has focused on the use of Unicode and the relationship
> with IDNA2008.
>
> You see my comments below.
>
> Best, Patrik Fältström
>
>> draft-ietf-precis-framework-20
>>
>> Abstract
>>
>> Application protocols using Unicode characters in protocol strings
>> need to properly handle such strings in order to enforce
>> internationalization rules for strings placed in various protocol
>> slots (such as addresses and identifiers) and to perform valid
>> comparison operations (e.g., for purposes of authentication or
>> authorization).  This document defines a framework enabling
>> application protocols to perform the preparation, enforcement, and
>> comparison of internationalized strings ("PRECIS") in a way that
>> depends on the properties of Unicode characters and thus is agile
>> with respect to versions of Unicode.  As a result, this framework
>> provides a more sustainable approach to the handling of
>> internationalized strings than the previous framework, known as
>> Stringprep ( RFC 3454).  This document obsoletes RFC 3454 .
>
> Explanation on what my review is concentrating on:
>
> When using a character set like Unicode where things like
> transformation, comparisons etc, the actual transformation can happen
> in multiple locations in the architecture, and what is needed is for
> applications to understand what format the strings are that are
> received and what format strings are expected to be in when being
> sent. Of course the principle of "be liberal in what you accept, and
> conservative in what you send" is very important.
>
> A simplified sketch of the architecture is as follows:
>
> 1. [A] sends a string to [B] for storage
>
> 2. [C] send a string to be for lookup, which implies matching
> algorithm is applied
>
> 3. If there is a match, data is sent back to [C]
>
> In this very simple way of looking at the issues the questions
> include:
>
> A. What Unicode code points should [A] accept as input
>
> B. What transformation is [A] expected to do?
>
> C. What transformation is [A] allowed to do?
>
> D. What Unicode code points is [A] allowed to send to [B]?
>
> E. What Unicode code points can [B] expect from [A]?
>
> F. What transformation is [B] expected to do on data sent from [A]
> before data is stored in the database?
>
> : :
>
> I.e. it must be as clear as possible for each one of the parties A, B
> and C what they are expected to do, what they must (and must not)
> do.

For the profiles and application usages that go along with the framework 
(draft-ietf-precis-saslprepbis, draft-ietf-precis-nickname, 
draft-ietf-xmpp-6122bis), we have tried to address the considerations 
you raise. However, I think that in several places we could do a better 
job, such as:

i. Explain not only what entities are expected to do, but also what they 
are allowed to do.

ii. Specify what various using applications need to do (e.g., I don't 
think we've made that fully clear in the saslprepbis and nickname 
documents, although I think it is very clear in 6122bis).

These are matters that we can focus on during WGLC for those specs, I think.

> And of course ultimately the issue/trouble is that the Unicode
> Character Set is created and designed in such a way that there are
> many equivalences that humans in various contexts do expect are to be
> treated as "the same". Of course different in different contexts.

Indeed.

> Now to the review...
>
>> 4.  Enable application protocols to define profiles of the PRECIS
>> string classes if necessary (addressing matters such as width
>> mapping, case mapping, Unicode normalization, and directionality)
>> but strongly discourage the multiplication of profiles beyond
>> necessity in order to avoid violations of the Principle of Least
>> User Astonishment.
>
> It must also be clear who has the responsibility to do whatever
> transformations needed.

Yes. See above and below in this message, other messages in this thread, 
and the forthcoming revised I-D.

>> It is expected that this framework will yield the following
>> benefits:
>>
>> o  Application protocols will be agile with regard to Unicode
>> versions.
>>
>> o  Implementers will be able to share code point tables and
>> software code across application protocols, most likely by means
>> of software libraries.
>>
>> o  End users will be able to acquire more accurate expectations
>> about the characters that are acceptable in various contexts.
>> Given this more uniform set of string classes, it is also expected
>> that copy/paste operations between software implementing different
>> application protocols will be more predictable and coherent.
>
> It must also to everyone involved be clear what is the normative
> authoritative source for what is allowed and not.
>
> For IDNA2008 (for example) it is the _algorithm_ that is normative.
> Not any tables that are derivatives from applying the algorithm on a
> specific version of the Unicode Character Set.

Agreed. That's why the introduction states:

    The character categories and calculation rules defined under
    Section 7 and Section 8 are normative and apply to all Unicode code
    points.  The code point table that results from applying the
    character categories and calculation rules to the latest version of
    Unicode can be found in an IANA registry.

>> When an application applies a profile of a PRECIS string class, it
>> can achieve the following objectives:
>>
>> a.  Determine if a given string conforms to the profile, thus
>> enabling enforcement of the rules (e.g., to determine if a string
>> is allowed for use in the relevant protocol slot specified by an
>> application protocol).
>>
>> b.  Determine if any two given strings are equivalent, thus
>> enabling comparision (e.g., to make an access decision for purposes
>> of authentication or authorization as further described in [
>> RFC6943 ]).
>
> And of course applying transformation on a string being received
> before it is passed on to the next step of whatever process the
> application is participating in. In this case, the string is in one
> form before the transformation and another form after the
> transformation. It must also be clear to everyone involved that
> transformations applied very seldom (if at all) are reversible.
> Specifically this is the case when doing case folding
> transformations.

Ack.

>> 3.  Preparation, Enforcement, and Comparison
>>
>>
>> This document distinguishes between three different actions that
>> an entity can take with regard to a string:
>>
>> o  Enforcement entails applying all of the rules specified for a
>> particular string class or profile thereof to an individual string,
>> for the purpose of determining if the string can be used in a given
>> protocol slot.
>>
>> o  Comparison entails applying all of the rules specified for a
>> particular string class or profile thereof to two separate strings,
>> for the purpose of determining if the two strings are equivalent.
>
> In fact I think the "comparison" entitles three steps:
>
> 1. Apply all transformation and enforcement on string A.
>
> 2. Apply all transformation and enforcement on string B.
>
> 3. Compare the strings A and B unicode character by character. Only
> if all characters are the same, a positive match is the result.

Agreed. I'll adjust the text along those lines.

>> o  Preparation entails only ensuring that the characters in an
>> individual string are allowed by the underlying PRECIS string
>> class.
>
> I think the idea with "preparation" is to apply certain
> transformation and to, after transformation, ensure all characters in
> the context they exist, are allowed, so that the final string after
> the preparation step is a valid precis string?

During discussion of draft-ietf-xmpp-6122bis in the XMPP WG, several 
commenters noted that they would prefer to assign more lightweight 
processing to entities that are not capable of full enforcement of all 
the rules for a profile (i.e., not heavy or advanced tasks like Unicode 
normalization). Out of that conversation emerged the concept of 
"preparation" as involving only limits on the character ranges.

Perhaps we could have chosen a less ambiguous term than "preparation"?

> I would recommend explicitly mentioning the fact (destructive)
> transformation might occur in this step.

Destructive transformation doesn't sound good. Do you have examples of 
what that means?

>> In most cases, authoritative entities such as servers are
>> responsible for enforcement, whereas subsidiary entities such as
>> clients are responsible only for preparation.  The rationale for
>> this distinction is that clients might not have the facilities (in
>> terms of device memory and processing power) to enforce all the
>> rules regarding internationalized strings (such as width mapping
>> and Unicode normalization), although they can more easily limit the
>> repertoire of characters they offer to an end user.  By contrast,
>> it is assumed that a server would have more capacity to enforce the
>> rules, and in any case acts as an authority regarding allowable
>> strings in protocol slots such as addresses and endpoint
>> identifiers.  In addition, a client cannot necessarily be trusted
>> to properly generate such strings, especially for
>> security-sensitive contexts such as authentication and
>> authorization.
>
> This paragraph is very vague. I think the protocol need a much
> stricter specification on who is expected to do what. This because
> the protocol itself (that is for example between client and server)
> must be robust enough to carry whatever code points the client is
> using.

Yes, and that's what each application usage or profile needs to specify 
very clearly. We can provide some guidelines for such text in the 
framework, but I don't think we can provide that text for all 
applications here.

>> Valid:  Defines which code points and character categories are
>> treated as valid input to the string.
>
> The term "input" is not clear to me, given transformation might
> occur.

Good point. Will fix.

>> Disallowed:  Defines which code points and character categories
>> need to be excluded from the string.
>
> It is a bit confusing to talk about both categories and code points
> at the same time. I would recommend in this point in time in the
> document talk about what code points are disallowed. Reason for this
> is that you might have a category that is disallowed while the code
> point that is of that category is allowed (based on other rules, like
> exceptions). To make it crystal clear what is disallowed, I recommend
> only use that term for code points.

Yes, we'll change that.

>> 4.2.1.  Valid
>>
>>
>> o  Code points traditionally used as letters and numbers in
>> writing systems, i.e., the LetterDigits ("A") category first
>> defined in [ RFC5892] and listed here under Section 8.1 .
>>
>> o  Code points in the range U+0021 through U+007E, i.e., the
>> (printable) ASCII7 ("K") rule defined under Section 8.11 .  These
>> code points are "grandfathered" into PRECIS and thus are valid even
>> if they would otherwise be disallowed according to the
>> property-based rules specified in the next section.
>>
>> Note: Although the PRECIS IdentifierClass re-uses the LetterDigits
>> category from IDNA2008, the range of characters allowed in the
>> IdentifierClass is wider than the range of characters allowed in
>> IDNA2008.  The main reason is that IDNA2008 applies the Unstable
>> category before the LetterDigits category, thus disallowing
>> uppercase characters, whereas the IdentifierClass does not apply
>> the Unstable category.
>
> You must remove the code points of class ("C") in RFC5892.

The only difference between class "C" (IDNA2008) and class "M" (PRECIS) 
is that in PRECIS we allow white space code points in the FreeformClass. 
Thus we use "C", not "M".

> Or to state things differently. If one look at the Unicode tables,
> the following combination of matches exists for code points that
> matches category "A" and at least one more category, for Unicode
> 7.0.0:
>
> AB ABC ABF AC ACI AD AE AF AI
>
> There are several of these combinations that is given this definition
> is valid which I would not say is recommended for use for
> identifiers.

OK, I will look at this more closely.

> Further, regarding not including stable. This implies it is allowed
> to use code points in Precis that are not stable regarding
> normalization and/or case folding. The normalization and/or case
> folding still must be made somewhere before matching is happening.
>
> Lets for example say that "A" and "a" are both valid (which they
> would be). The question is then whether there is case mapping before
> comparison or not, and if there is, it must be ensured that the two
> identities "A" and "a" are not both created in some name space.
>
> I know this is exactly what you have been talking about and
> discussing, but it must be absolutely crystal clear everyone
> understand what this implies. Specifically when case folding (lower
> case) is replaced with NFC or some normalization algorithm.

I think this is handled more directly by the UsernameCaseMapped and 
UsernameCasePreserved profiles of the IdentifierClass specified in 
draft-ietf-precis-saslprepbis.

> More about this later.

There is always more to be said about i18n. :-)

>> 4.2.3.  Disallowed
>
> See above.
>
>> Some application technologies need strings that can be used in a
>> free-form way, e.g., as a password in an authentication exchange
>> (see [ I-D.ietf-precis-saslprepbis ]) or a nickname in a chatroom
>> (see [ I-D.ietf-precis-nickname ]).  We group such things into a
>> class called "FreeformClass" having the following features.
>>
>> Security Warning: As mentioned, the FreeformClass prioritizes
>> expressiveness over safety; Section 11.3 describes some of the
>> security hazards involved with using or profiling the
>> FreeformClass.
>>
>> Security Warning: Consult Section 11.6 for relevant security
>> considerations when strings conforming to the FreeformClass, or a
>> profile thereof, are used as passwords.
>
> There are very dangerous issues here when using this class for any
> kind of comparison.  Specifically in the case of password and user
> names (or file names)

We actively discourage the use of the FreeformClass (or profiles 
thereof) for user names, file names, and the like.

See however draft-ietf-precis-nickname, where we use a profile of the 
FreeformClass for nicknames (e.g., in a chatroom).

> where it is unclear what kind of normalization
> might happen between "the keyboard" and "the application". I.e. the
> user might really really think they enter a certain code point, but
> in reality what the application see is either NFC(string) or
> NFD(string) and which one might vary on the operating system (or file
> system) in use. Specifically when leaving this undefined.
>
> I am all in favor of leaving this undefined for this class, but then
> it might not be the best to do any kind of matching (including
> searching). Unless some kind of transformation is made for the
> matching/searching.

We might need some more text about these matters in the profiles that 
use the FreeformClass: OpaqueString (in saslprepbis) and Nickname. 
Another topic to fix during WGLC.

> I would recommend the following general rules:
>
> - IdentifierClass are used wherever it is importan the namespace
> include only globally unique strings, like identifiers for user names
> etc

Agreed.

> - IdentifierClass are also used for passwords

That might not be consistent with the need for entropy in passwords. See 
draft-ietf-precis-saslprepbis on this point.

> and whenever a
> comparison is used,

Ideally, passwords are not stored in the clear, which case some kind of 
transformation will need to happen before any comparison is done. That's 
why draft-ietf-precis-saslprepbis states:

    In protocols that provide passwords as input to a cryptographic
    algorithm such as a hash function, the client will need to perform
    proper preparation of the password before applying the algorithm,
    since the password is not available to the server in plaintext form.

> but the transformation should not be
> destructive.

Here again I'm not sure exactly what that means.

> - FreeformClass is used for storage of various things
>
> - Protocols must be stable for FreeformClass in the transport

If you have time, could you expand upon those two points a bit?

>> 4.3.1.  Valid
>
> See comments above regarding combination of A with other categories.
>
>> 5.1.  Profiles Must Not Be Multiplied Beyond Necessity
>>
>>
>> The risk of profile proliferation is significant because having
>> too many profiles will result in different behavior across various
>> applications, thus violating what is known in user interface
>> design as the Principle of Least Astonishment.
>>
>> Indeed, we already have too many profiles.  Ideally we would have
>> at most two or three profiles.  Unfortunately, numerous
>> application protocols exist with their own quirks regarding
>> protocol strings.
>>
>> Domain names, email addresses, instant messaging addresses,
>> chatroom nicknames, filenames, authentication identifiers,
>> passwords, and other strings are already out there in the wild and
>> need to be supported in existing application protocols such as DNS,
>> SMTP, XMPP, IRC, NFS, iSCSI, EAP, and SASL among others.
>>
>> Nevertheless, profiles must not be multiplied beyond necessity.
>>
>> To help prevent profile proliferation, this document recommends
>> sensible defaults for the various options offered to profile
>> creators (such as width mapping and Unicode normalization).  In
>> addition, the guidelines for designated experts provided under
>> Section 9 are meant to encourage a high level of due diligence
>> regarding new profiles.
>
> What are the requirements to create a new Profile?

Rule #1: Don't create new profiles.

Rule #2: Don't ignore Rule #1.

Rule #3: If you push on through the first two rules, provide a strong 
justification for the new profile and answer all the questions under the 
IANA considerations in the framework. Even then, expect a lot of 
pushback from the designated experts.

> Either there are requirements or not. This text above does not add
> much help if there is a conflict in the future regarding request for
> registration of a new Profile. Are you really happy with what is
> above?

I'm happy with the totality of information and requirements in Sections 
5.1, 9, and 10.3 of framework-20.

> The WG must honestly say "yes" to this. If they do, I am happy! :-)

I can't speak for the WG. :-)

>> 5.2.1.  Width Mapping Rule
>>
>>
>> The width mapping rule of a profile specifies whether width
>> mapping is performed on fullwidth and halfwidth characters, and how
>> the mapping is done.  Typically such mapping consists of mapping
>> fullwidth and halfwidth characters, i.e., code points with a
>> Decomposition Type of Wide or Narrow, to their decomposition
>> mappings; as an example, FULLWIDTH DIGIT ZERO (U+FF10) would be
>> mapped to DIGIT ZERO (U+0030).
>>
>> The normalization form specified by a profile (see below) has an
>> impact on the need for width mapping.  Because width mapping is
>> performed as a part of compatibility decomposition, a profile
>> employing either normalization form KD (NFKD) or normalization
>> form KC (NFKC) does not need to specify width mapping.  However,
>> if Unicode normalization form C (NFC) is used (as is recommended)
>> then the profile needs to specify whether to apply width mapping;
>> in this case, width mapping is in general RECOMMENDED because
>> allowing fullwidth and halfwidth characters to remain unmapped to
>> their compatibility variants would violate the Principle of Least
>> Astonishment.  For more information about the concept of width in
>> East Asian scripts within Unicode, see Unicode Standard Annex #11
>> [ UAX11 ].
>
> Doing this mapping is not easy. I strongly recommend an algorithm is
> presented that either is in use or not by the profile.

We've been trying not to define new algorithms. Is there one we can can 
point to elsewhere?

>> 5.2.3.  Case Mapping Rule
>>
>>
>> The case mapping rule of a profile specifies whether case mapping
>> is performed (instead of case preservation) on uppercase and
>> titlecase characters, and how the mapping is done (e.g., mapping
>> uppercase and titlecase characters to their lowercase
>> equivalents).
>
> You either apply mapping or not, to _all_ code points. The above make
> it sort of look like if case mapping is sometimes not to be
> performed.

Would we ever apply case mapping to characters other than upperase and 
titlecase characters? Perhaps you mean only to point out that the rule 
is applied to all code points, but only uppercase and titlecase code 
points are transformed by the rule. If so, the text is easy to adjust.

>> If case mapping is desired (instead of case preservation), it is
>> RECOMMENDED to use Unicode Default Case Folding as defined in
>> Chapter 3 of the Unicode Standard [ Unicode7.0 ].
>>
>> Note: Unicode Default Case Folding is not designed to handle
>> various localization issues (such as so-called "dotless i" in
>> several Turkic languages).  The PRECIS mappings document [
>> I-D.ietf-precis-mappings ] describes these issues in greater detail
>> and defines a "local case mapping" method that handles some
>> locale-dependent and context-dependent mappings.
>>
>> In order to maximize entropy and minimize the potential for false
>> positives, it is NOT RECOMMENDED for application protocols to map
>> uppercase and titlecase code points to their lowercase equivalents
>> when strings conforming to the FreeformClass, or a profile
>> thereof, are used in passwords; instead, it is RECOMMENDED to
>> preserve the case of all code points contained in such strings and
>> then perform case-sensitive comparison.  See also the related
>> discussion in [ I-D.ietf-precis-saslprepbis ].
>
> The above is too complicated.

It is long-winded, but is it more complicated than your terse versino below?

> The only realistic way of handling casing is to:
>
> 1. Decide whether there is case insensitive matching to be done or
> not
>
> 2. If it is, case fold to lower case before the matching
>
> 3. If transformation of a string is made, case fold to lower case as
> part of the transformation

If I understand the difference between (2) and (3) correctly, (2) 
applies to case-insensitive matching (e.g., an application might 
preserve case on storing strings but compare two output strings in a 
case-insensitive way), whereas (3) applies to storage of strings in some 
canonical format.

> 4. Do not forget issues with normalization and case folding both be
> applied on the same string

Yes, I will give more thought to that and see if we can add some 
appropriate text.

>> 5.2.5.  Directionality Rule
>>
>>
>> The directionality rule of a profile specifies how to treat
>> strings containing left-to-right (LTR) and right-to-left (RTL)
>> characters (see Unicode Standard Annex #9 [ UAX9 ]).  A profile
>> usually specifies a directionality rule that restricts strings to
>> be entirely LTR
>> strings or entirely RTL strings and defines the allowable
>> sequences of characters in LTR and RTL strings.  Possible rules
>> include, but are not limited to, (a) considering any string that
>> contains a right- to-left code point to be a right-to-left string,
>> or (b) applying the "Bidi Rule" from [ RFC5893 ].
>
> One can not restrict to only LTR or RTL as some code points are
> neutral regarding directionality.
>
> See RFC5893. This was one of the mistakes in IDNA2003.

I think you're right that the foregoing text is not quite correct.

And in any case, as John Klensin reiterated at the mic in a recent 
PRECIS WG session, if we define something other than the Bidi Rule then 
we'll likely get it wrong. I think that text predates John's comments 
and hasn't been updated..

>> Mixed-direction strings are not directly supported by the PRECIS
>> framework itself, since there is currently no widely accepted and
>> implemented solution for the safe display of mixed-direction
>> strings.
>
> Define Mixed-Direction strings or else the text will be confusing.

Will do.

>> username   = userpart *(1*SP userpart) userpart   = 1*(idbyte) ; ;
>> an "idbyte" is a byte used to represent a ; UTF-8 encoded Unicode
>> code point that can be ; contained in a string that conforms to
>> the ; PRECIS "IdentifierClass" ;
>
> Do not talk about "byte" here but instead "character". So, in the
> grammar, talk about Unicode Code Points. How the Unicode string is
> then encoding (for example UTF-8) is a different issue.

Hmm. All of the new profiles or application usages specify UTF-8. This 
issue of bytes/octets vs. characters caused us problems in XMPP (in part 
because we specify length limits). I'll need to look at it more closely 
before making a change.

>> 6.  Order of Operations
>>
>>
>> To ensure proper comparison, the rules specified for a particular
>> string class or profile MUST be applied in the following order:
>
> It must, as I started with saying above, be clear when these
> operations take place. Is it a (destructive) transformation done
> somewhere (application, client side, server side) or just something
> part of a matching algorithm?

Yes, we've tried to address that in profile and application specs.

>> 8.3.  IgnorableProperties (C)
>>
>>
>> This category is defined in Secton 2.3 of [ RFC5892 ] but is not
>> used in PRECIS.
>>
>> Note: See the "PrecisIgnorableProperties (M)" category below for a
>> more inclusive category used in PRECIS identifiers.
>
> See comments above.
>
>> 8.7.  BackwardCompatible (G)
>>
>>
>> This category is defined in Secton 2.7 of [ RFC5892 ] and is
>> included by reference for use in PRECIS.
>>
>> Note: Because of how the PRECIS string classes are defined, only
>> changes that would result in code points being added to or removed
>> from the LetterDigits ("A") category would result in backward-
>> incompatible modifications to code point assignments.
>
> Are you sure? I am not.

I think we just leave that up to RFC 5892 and remove that note.

>> Therefore, management of this category is handled via the processes
>> specified in [ RFC5892 ].  At the time of this writing (and also at
>> the time that
>>
>> RFC 5892 was published), this category consisted of the empty set;
>> however, that is subject to change as described in RFC 5892 .
>
> This is true on the other hand.
>
>> 8.13.  PrecisIgnorableProperties (M)
>>
>>
>> This PRECIS-specific category is used to group code points that
>> are discouraged from use in PRECIS string classes.
>>
>> M: Default_Ignorable_Code_Point(cp) = True or
>> Noncharacter_Code_Point(cp) = True
>>
>> The definition for Default_Ignorable_Code_Point can be found in
>> the DerivedCoreProperties.txt [ 2 ] file, and at the time of
>> Unicode 7.0 is as follows:
>>
>> Other_Default_Ignorable_Code_Point + Cf (Format characters) +
>> Variation_Selector - White_Space - FFF9..FFFB (Annotation
>> Characters) - 0600..0604, 06DD, 070F, 110BD (exceptional Cf
>> characters that should be visible)
>
> I would be very nervous over having explicit code points in a generic
> rule like this. If the code points are to be listed explicitly, add
> them to an exception rule. Otherwise *this* rule have to be changed
> when future changes have to be made that would require otherwise
> exceptions to be added.

That simply repeats what Unicode 7.0 says, but we can remove it to 
prevent developer confusion.

>> 8.14.  Spaces (N)
>>
>>
>> This PRECIS-specific category is used to group code points that
>> are space characters.
>>
>> N: General_Category(cp) is in {Zs}
>
> I am still thinking of how "spaces" is handled here. Will check and
> think more when I look at the mapping documents. Specifically when
> you also look at Arabic and other similar scripts. Just do
> destructive transformation to U+0020 is not always working I think.

We have had a lot of discussion about space characters, not really 
captured all that well in the specs. But see Section 5.5:

5.5.  A Note about Spaces

    With regard to the IdentiferClass, the consensus of the PRECIS
    Working Group was that spaces are problematic for many reasons,
    including:

    o  Many Unicode characters are confusable with ASCII space.

    o  Even if non-ASCII space characters are mapped to ASCII space
       (U+0020), space characters are often not rendered in user
       interfaces, leading to the possibility that a human user might
       consider a string containing spaces to be equivalent to the same
       string without spaces.

    o  In some locales, some devices are known to generate a character
       other than ASCII space (such as ZERO WIDTH JOINER, U+200D) when a
       user performs an action like hitting the space bar on a keyboard.

    One consequence of disallowing space characters in the
    IdentifierClass might be to effectively discourage their use within
    identifiers created in newer application protocols; given the
    challenges involved with properly handling space characters
    (especially non-ASCII space characters) in identifiers and other
    protocol strings, the PRECIS Working Group considered this to be a
    feature, not a bug.

    However, the FreeformClass does allow spaces, which enables
    application protocols to define profiles of the FreeformClass that
    are more flexible than any profiles of the IdentifierClass.  In
    addition, as explained in the previous section, application protocols
    can also define application-layer constructs containing spaces.

>> 8.17.  HasCompat (Q)
>>
>>
>> This PRECIS-specific category is used to group code points that
>> have compatibility equivalents as explained in Chapter 2 and
>> Chapter 3 of the Unicode Standard [ Unicode7.0 ].
>>
>> Q: toNFKC(cp) != cp
>>
>> The toNFKC() operation returns the code point in normalization
>> form KC.  For more information, see Section 5 of Unicode Standard
>> Annex #15 [ UAX15 ].
>
> Think about implications of this together with case folding (or
> not).

I shall. :-)

Thanks again for the review. I'll work to update the spec soon.

Peter

-- 
Peter Saint-Andre
CTO @ &yet
https://andyet.com/

---

From: Patrik Fältström <[email-masked]>
Date: Mon, 8 Dec 2014 06:58:03 +0100

> On 8 dec 2014, at 04:49, Peter Saint-Andre - &yet <[email-masked]> wrote:
> 
> Destructive transformation doesn't sound good. Do you have examples of what that means?

When you do a transformation that does not have an inverse. For example lowercase.

uppercase(lowercase(cp)) is not cp for all values of cp.

In IDNA2003, the mappings where destructive, which implied that "toascii(unicode string)" (within quotes, because I think you know what I talk about) is not possible to reserve.

In IDNA2008, the ascii version and unicode version of a domain name are 1:1 mappings and the transformation can be done however many times you want.

This because the mapping is _removed_ from IDNA2008, so IF one is interested in doing mappings, that is to be done before IDNA2008 is applied. Anything "inside" IDNA2008 consists of strings either in their ASCII version (xn-- thing) or Unicode version (in Unicode). And it is possible to transform one to the other back and forth.

   Patrik

---

From: Peter Saint-Andre - &yet <[email-masked]>
Date: Wed, 10 Dec 2014 21:36:54 -0700

One specific question below...

> OK, I will look at this more closely.

I don't quite understand your concern here.

Are you saying that there are code points that match, say, the 
LetterDigits category ("A") and the IgnorableProperties category ("C") 
and the OldHangulJamo category ("I")?

Peter

---

From: Patrik Fältström <[email-masked]>
Date: Thu, 11 Dec 2014 07:22:45 +0100

> On 11 dec 2014, at 05:36, Peter Saint-Andre - &yet <[email-masked]> wrote:
> 
> Are you saying that there are code points that match, say, the LetterDigits category ("A") and the IgnorableProperties category ("C") and the OldHangulJamo category ("I")?

Yes. There are in fact two codepoints that matches all of A, C and I at the same time. U+115F and U+1160.

Hope this below give you some data. The file allcodepoints.txt is one I have produced with one of the software packages I have written as part of my role as appointed expert re. IANA and IDNA. The file is in this example generated for Unicode 7.0.0.

#for i in AB ABC ABF AC ACI AD AE AF AI; do
#echo $i
#grep ";$i;" allcodepoints.txt | wc -l
#grep ";$i;" allcodepoints.txt | head -5
#done
AB
    4479
0041;DISALLOWED;I;AB;LATIN CAPITAL LETTER A
0042;DISALLOWED;I;AB;LATIN CAPITAL LETTER B
0043;DISALLOWED;I;AB;LATIN CAPITAL LETTER C
0044;DISALLOWED;I;AB;LATIN CAPITAL LETTER D
0045;DISALLOWED;I;AB;LATIN CAPITAL LETTER E
ABC
       2
3164;DISALLOWED;I;ABC;HANGUL FILLER
FFA0;DISALLOWED;I;ABC;HALFWIDTH HANGUL FILLER
ABF
       2
00DF;PVALID;I;ABF;LATIN SMALL LETTER SHARP S
03C2;PVALID;I;ABF;GREEK SMALL LETTER FINAL SIGMA
AC
     262
034F;DISALLOWED;I;AC;COMBINING GRAPHEME JOINER
17B4;DISALLOWED;I;AC;KHMER VOWEL INHERENT AQ
17B5;DISALLOWED;I;AC;KHMER VOWEL INHERENT AA
180B;DISALLOWED;I;AC;MONGOLIAN FREE VARIATION SELECTOR ONE
180C;DISALLOWED;I;AC;MONGOLIAN FREE VARIATION SELECTOR TWO
ACI
       2
115F;DISALLOWED;I;ACI;HANGUL CHOSEONG FILLER
1160;DISALLOWED;I;ACI;HANGUL JUNGSEONG FILLER
AD
      59
20D0;DISALLOWED;I;AD;COMBINING LEFT HARPOON ABOVE
20D1;DISALLOWED;I;AD;COMBINING RIGHT HARPOON ABOVE
20D2;DISALLOWED;I;AD;COMBINING LONG VERTICAL LINE OVERLAY
20D3;DISALLOWED;I;AD;COMBINING SHORT VERTICAL LINE OVERLAY
20D4;DISALLOWED;I;AD;COMBINING ANTICLOCKWISE ARROW ABOVE
AE
      36
0030;PVALID;I;AE;DIGIT ZERO
0031;PVALID;I;AE;DIGIT ONE
0032;PVALID;I;AE;DIGIT TWO
0033;PVALID;I;AE;DIGIT THREE
0034;PVALID;I;AE;DIGIT FOUR
AF
      30
0640;DISALLOWED;I;AF;ARABIC TATWEEL
0660;CONTEXTO;I;AF;ARABIC-INDIC DIGIT ZERO
0661;CONTEXTO;I;AF;ARABIC-INDIC DIGIT ONE
0662;CONTEXTO;I;AF;ARABIC-INDIC DIGIT TWO
0663;CONTEXTO;I;AF;ARABIC-INDIC DIGIT THREE
AI
     355
1100;DISALLOWED;I;AI;HANGUL CHOSEONG KIYEOK
1101;DISALLOWED;I;AI;HANGUL CHOSEONG SSANGKIYEOK
1102;DISALLOWED;I;AI;HANGUL CHOSEONG NIEUN
1103;DISALLOWED;I;AI;HANGUL CHOSEONG TIKEUT
1104;DISALLOWED;I;AI;HANGUL CHOSEONG SSANGTIKEUT
#

   Patrik

---

From: Peter Saint-Andre - &yet <[email-masked]>
Date: Thu, 11 Dec 2014 09:43:39 -0700

On 12/10/14, 11:22 PM, Patrik Fältström wrote:
>> LetterDigits category ("A") and the IgnorableProperties category
>> ("C") and the OldHangulJamo category ("I")?
>
> Hope this below give you some data. The file allcodepoints.txt is one
> I have produced with one of the software packages I have written as
> part of my role as appointed expert re. IANA and IDNA. The file is in
> this example generated for Unicode 7.0.0.

That's great, thank you.

Although it's good to know about this overlap, I am wondering if in 
practice it matters because in both IDNA2008 and PRECIS we specify the 
order of operations. Do you think we need to have an informational note 
about this in the framework, though?

Peter

---

From: Patrik Fältström <[email-masked]>
Date: Fri, 12 Dec 2014 00:53:21 +0100

> On 11 dec 2014, at 17:43, Peter Saint-Andre - &yet <[email-masked]> wrote:
> 
> Although it's good to know about this overlap, I am wondering if in practice it matters because in both IDNA2008 and PRECIS we specify the order of operations. Do you think we need to have an informational note about this in the framework, though?

Not as long as the _result_ of the actions you suggest leads to a stable result.

I.e. either your rules are stable (and leads to stable result) or not. Clarifying language that explain is not what you need in this case. Either the rules are clean or not.

   Patrik

---

From: Peter Saint-Andre - &yet <[email-masked]>
Date: Thu, 11 Dec 2014 19:13:13 -0700

Indeed.

You highlight the following possibilities:

In PRECIS, we don't use categories B, C, D, and E.

Thus if we have concerns, they would be over AF (LetterDigits and 
Exceptions) and AI (LetterDigits and OldHangulJamo).

Yet the algorithm seems definitive:

    If .cp. .in. Exceptions Then Exceptions(cp);
    Else If .cp. .in. BackwardCompatible Then BackwardCompatible(cp);
    Else If .cp. .in. Unassigned Then UNASSIGNED;
    Else If .cp. .in. ASCII7 Then PVALID;
    Else If .cp. .in. JoinControl Then CONTEXTJ;
    Else If .cp. .in. OldHangulJamo Then DISALLOWED;
    Else If .cp. .in. PrecisIgnorableProperties Then DISALLOWED;
    Else If .cp. .in. Controls Then DISALLOWED;
    Else If .cp. .in. HasCompat Then ID_DIS or FREE_PVAL;
    Else If .cp. .in. LetterDigits Then PVALID;
    Else If .cp. .in. OtherLetterDigits Then ID_DIS or FREE_PVAL;
    Else If .cp. .in. Spaces Then ID_DIS or FREE_PVAL;
    Else If .cp. .in. Symbols Then ID_DIS or FREE_PVAL;
    Else If .cp. .in. Punctuation Then ID_DIS or FREE_PVAL;
    Else DISALLOWED;

The PRECIS framework doesn't allow classes or profiles or applications 
to change the order of operations within the algorithm. However, we 
could add normative language about that in the spec (which doesn't 
currently say that you MUST NOT change the order).

Peter

---

From: Peter Saint-Andre - &yet <[email-masked]>
Date: Thu, 11 Dec 2014 19:19:37 -0700

On 12/11/14, 7:13 PM, Peter Saint-Andre - &yet wrote:
>>> practice it matters because in both IDNA2008 and PRECIS we specify
>>> the order of operations. Do you think we need to have an
>>> informational note about this in the framework, though?
>>
>> I.e. either your rules are stable (and leads to stable result) or not.
>> Clarifying language that explain is not what you need in this case.
>> Either the rules are clean or not.
>
> Indeed.
>

That is, I would propose this change in Section 8...

OLD
    The algorithm to calculate the value of the derived property is as
    follows:

NEW
    The algorithm to calculate the value of the derived property is as
    follows (implementations MUST NOT modify the order of operations
    within this algorithm, since doing so would cause inconsistent
    results across implementations):

Peter

---

From: Peter Saint-Andre - &yet <[email-masked]>
Date: Tue, 23 Dec 2014 19:59:07 -0700

> These are matters that we can focus on during WGLC for those specs, I

I have updated the saslprepbis and nickname specs in an attempt to 
address these issues:

http://tools.ietf.org/rfcdiff?url2=draft-ietf-precis-saslprepbis-13.txt

http://tools.ietf.org/rfcdiff?url2=draft-ietf-precis-nickname-14.txt

Peter

-- 
Peter Saint-Andre
https://andyet.com/