Re: [jose] JWK member names, was: SECDIR review of draft-ietf-jose-json-web-key-31

Mike Jones <Michael.Jones@microsoft.com> Fri, 12 September 2014 16:20 UTC

Return-Path: <Michael.Jones@microsoft.com>
X-Original-To: jose@ietfa.amsl.com
Delivered-To: jose@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 76F651A6F81; Fri, 12 Sep 2014 09:20:42 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Level:
X-Spam-Status: No, score=-1.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DSN-TeVnsqf9; Fri, 12 Sep 2014 09:20:36 -0700 (PDT)
Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0144.outbound.protection.outlook.com [207.46.100.144]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 6A2811A0704; Fri, 12 Sep 2014 09:20:34 -0700 (PDT)
Received: from BN3PR0301CA0063.namprd03.prod.outlook.com (25.160.152.159) by BL2PR03MB605.namprd03.prod.outlook.com (10.255.109.39) with Microsoft SMTP Server (TLS) id 15.0.1029.13; Fri, 12 Sep 2014 16:20:32 +0000
Received: from BY2FFO11FD028.protection.gbl (2a01:111:f400:7c0c::190) by BN3PR0301CA0063.outlook.office365.com (2a01:111:e400:401e::31) with Microsoft SMTP Server (TLS) id 15.0.1029.13 via Frontend Transport; Fri, 12 Sep 2014 16:20:32 +0000
Received: from mail.microsoft.com (131.107.125.37) by BY2FFO11FD028.mail.protection.outlook.com (10.1.15.217) with Microsoft SMTP Server (TLS) id 15.0.1019.14 via Frontend Transport; Fri, 12 Sep 2014 16:20:32 +0000
Received: from TK5EX14MBXC292.redmond.corp.microsoft.com ([169.254.1.60]) by TK5EX14HUBC107.redmond.corp.microsoft.com ([157.54.80.67]) with mapi id 14.03.0195.002; Fri, 12 Sep 2014 16:20:17 +0000
From: Mike Jones <Michael.Jones@microsoft.com>
To: Tim Bray <tbray@textuality.com>
Thread-Topic: [jose] JWK member names, was: SECDIR review of draft-ietf-jose-json-web-key-31
Thread-Index: AQHPzqIHj1de3PnVVUOZ99QaOQrAZJv9q2Yg
Date: Fri, 12 Sep 2014 16:20:15 +0000
Message-ID: <4E1F6AAD24975D4BA5B16804296739439AEC0929@TK5EX14MBXC292.redmond.corp.microsoft.com>
References: <CAHbuEH4Ccn2Z=8kEECzvgjmtshwsFoa-EH_NpkJPos7zirGeaQ@mail.gmail.com> <4E1F6AAD24975D4BA5B16804296739439AEC00DB@TK5EX14MBXC292.redmond.corp.microsoft.com> <CAHBU6itS0i-+iuS-28pZNm2ixE03OXRkQnVRO6g4=29G12sT2g@mail.gmail.com>
In-Reply-To: <CAHBU6itS0i-+iuS-28pZNm2ixE03OXRkQnVRO6g4=29G12sT2g@mail.gmail.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [157.54.51.32]
Content-Type: multipart/alternative; boundary="_000_4E1F6AAD24975D4BA5B16804296739439AEC0929TK5EX14MBXC292r_"
MIME-Version: 1.0
X-EOPAttributedMessage: 0
X-Forefront-Antispam-Report: CIP:131.107.125.37; CTRY:US; IPV:CAL; IPV:NLI; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(438002)(24454002)(377454003)(189002)(43784003)(51444003)(199003)(15975445006)(87936001)(95666004)(92566001)(85306004)(2656002)(92726001)(230783001)(83072002)(85852003)(104016003)(6806004)(80022001)(85806002)(84676001)(83322001)(19580405001)(69596002)(44976005)(68736004)(20776003)(66066001)(19580395003)(15202345003)(19300405004)(71186001)(64706001)(106116001)(90102001)(4396001)(81342001)(110136001)(106466001)(81156004)(107046002)(74502001)(74662001)(16236675004)(33656002)(31966008)(19625215002)(26826002)(50986999)(76176999)(54356999)(99396002)(77096002)(512874002)(21056001)(81542001)(97736003)(86612001)(19617315012)(84326002)(86362001)(79102001)(77982001)(76482001)(46102001)(55846006); DIR:OUT; SFP:1102; SCL:1; SRVR:BL2PR03MB605; H:mail.microsoft.com; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en;
X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;UriScan:;
X-O365ENT-EOP-Header: Message processed by - O365_ENT: Allow from ranges (Engineering ONLY)
X-Forefront-PRVS: 0332AACBC3
Received-SPF: Pass (protection.outlook.com: domain of microsoft.com designates 131.107.125.37 as permitted sender) receiver=protection.outlook.com; client-ip=131.107.125.37; helo=mail.microsoft.com;
Authentication-Results: spf=pass (sender IP is 131.107.125.37) smtp.mailfrom=Michael.Jones@microsoft.com;
X-OriginatorOrg: microsoft.onmicrosoft.com
Archived-At: http://mailarchive.ietf.org/arch/msg/jose/2lrp2lqfTZd6B9kivW_9R2ZB4XE
Cc: "jose-chairs@tools.ietf.org" <jose-chairs@tools.ietf.org>, Stephen Kent <kent@bbn.com>, "secdir@ietf.org" <secdir@ietf.org>, "draft-ietf-jose-json-web-key.all@tools.ietf.org" <draft-ietf-jose-json-web-key.all@tools.ietf.org>, Kathleen Moriarty <kathleen.moriarty.ietf@gmail.com>, "jose@ietf.org" <jose@ietf.org>
Subject: Re: [jose] JWK member names, was: SECDIR review of draft-ietf-jose-json-web-key-31
X-BeenThere: jose@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Javascript Object Signing and Encryption <jose.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/jose>, <mailto:jose-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/jose/>
List-Post: <mailto:jose@ietf.org>
List-Help: <mailto:jose-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/jose>, <mailto:jose-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 12 Sep 2014 16:20:42 -0000

I understand that that’s an ideal long-term solution, once I-JSON parsers are common/ubiquitous, but I don’t expect that to be the case for a number of years and people are using JOSE now.  Tim, you were one of the primary advocates for the position that implementers need to be able to use JSON parsers as they actually exist – hence the change from (1) to (2) in draft -12 in July 2013 after extensive working group discussion on the topic.

Unless you’ve changed your tune, I doubt that you’re actually saying that we should move back to (1) now, which would mean that people using today’s JSON parsers would be nonconformant?

Once I-JSON is ubiquitous, I’d be fine doing bis versions of the specs to tighten the requirement in a few years.  But until then, keeping the requirement that producers must not use duplicate member names would mean that if we do update to use I-JSON in the future, nothing would then break.

                                                            -- Mike

From: Tim Bray [mailto:tbray@textuality.com]
Sent: Friday, September 12, 2014 8:55 AM
To: Mike Jones
Cc: Kathleen Moriarty; jose@ietf.org; jose-chairs@tools.ietf.org; draft-ietf-jose-json-web-key.all@tools.ietf.org; secdir@ietf.org; Stephen Kent
Subject: Re: [jose] JWK member names, was: SECDIR review of draft-ietf-jose-json-web-key-31

I’m pretty sure that at some point before the end of the year the IETF will publish I-JSON (see https://datatracker.ietf.org/doc/draft-ietf-json-i-json/) which simply specifies that there MUST NOT be dupe keys.  Depending on the timeframe, referring to this might be a good solution.

On Fri, Sep 12, 2014 at 8:18 AM, Mike Jones <Michael.Jones@microsoft.com<mailto:Michael.Jones@microsoft.com>> wrote:
Sure.  Here’s an analysis of the requirements about duplicate member names.

There could be two very different kinds of objections to the present text:
A.  People think we have the semantics for duplicate identifiers wrong.
B.  People think we should explain the current semantics for duplicate identifiers more clearly.

I sure hope that we’re dealing with B and not A.  Stephen, which is the nature of your critique of this text?

If we’re in the realm of A, I think there are three possibilities for the semantics:

1.  Require producers not use duplicate members and require consumers to reject inputs with duplicate member names.
Pros:  This is the most locked-down, consistent, and alternative.
Cons:  Real JSON parsers don’t all reject duplicate inputs.  If we force people to write custom parsers, this will result in exploitable bugs (and some just won’t do it and won’t be conformant).

2.  Require producers not to use duplicate members but allow consumers to accept inputs with duplicate member names in the manner defined in ECMAscript.  (This is the current choice.)
Pros:  People can use all standard JSON parsers.  Producers are still required to produce well-formed data structures.
Cons:  The requirements on producers are stricter than those on consumers.

3.  Allow both producers and consumers to use duplicate members, with duplicate member names handled in the manner defined in ECMAscript.
Pros:  People can use ECMAscript parsers (which are more liberal than some JSON parsers).  The requirements on producers and consumers are the same.
Cons:  Hidden content can be inserted into duplicate member names.  This could give attackers a way to manipulate the inputs to crypto operations.  Strict JSON parsers (that reject inputs with duplicate members) can’t be used.

Practically, I think were we presently are (2) is the best compromise between implementability, consistency, and security.  The working group put a lot of discussion into this, including changing from (1) to (2) and it’s my sense that most agree we’ve landed in the right place.  From a security perspective, I don’t think that (3) is a viable option.

If people think that the current semantics are right but are not sufficiently clearly explained or motivated, I’d certainly welcome proposed text to clarify the explanation.

                                                            -- Mike

From: Kathleen Moriarty [mailto:kathleen.moriarty.ietf@gmail.com<mailto:kathleen.moriarty.ietf@gmail.com>]
Sent: Friday, September 12, 2014 5:00 AM
To: jose@ietf.org<mailto:jose@ietf.org>; jose-chairs@tools.ietf.org<mailto:jose-chairs@tools.ietf.org>; draft-ietf-jose-json-web-key.all@tools.ietf.org<mailto:draft-ietf-jose-json-web-key.all@tools.ietf.org>; secdir@ietf.org<mailto:secdir@ietf.org>; Stephen Kent; Mike Jones
Subject: JWK member names, was: [jose] SECDIR review of draft-ietf-jose-json-web-key-31

Hi Mike,

The text Steve called out below has been very problematic as you know.  Could you call out some options here as the last time this came up, we didn't resolve it.  The working group was asked for suggestions, but none came through.  If you could provide some options and then have the working group weigh in, I think that would be good.

I snipped away the rest of the review and changed the subject as not to get in the way of the current dialog.

Thanks.

On Wed, Sep 10, 2014 at 8:57 PM, Mike Jones <Michael.Jones@microsoft.com<mailto:Michael.Jones@microsoft.com>> wrote:
Hi Stephen.  Thanks for your detailed and useful review.  I’ve cc’ed the working group in my reply so they’re aware of the contents of your review.  Replies are inline below…

From: Stephen Kent [mailto:kent@bbn.com]
Sent: Tuesday, September 02, 2014 1:09 PM
To: secdir@ietf.org<mailto:secdir@ietf.org>; Mike Jones; jose-chairs@tools.ietf.org<mailto:jose-chairs@tools.ietf.org>; Moriarty, Kathleen
Subject: SECDIR review of draft-ietf-jose-json-web-key-31

[snip]

This section imposes a rather wimpy constraint on parameter names:



   The member names within a JWK MUST be unique; recipients MUST either

   reject JWKs with duplicate member names or use a JSON parser that

   returns only the lexically last duplicate member name, as specified

   in Section 15.12 (The JSON Object) of ECMAScript 5.1 [ECMAScript].


This text says that member names MUST be unique, but if they are not, that’s OK too; just use the last instance of a member with a duplicate name. This seems like a terrible design principle. It imposes what appears to be a requirement, then says how to accommodate data structures that fail to meet the requirement. This would seem to encourage sloppy implementations (for JWK generation). I’d like to see the rationale for this.





Unfortunately, the intentional laxness in the spec in this regard is a reflection of the semantics of the actual JSON specifications and implementations.  For instance, http://tools.ietf.org/html/rfc7159#section-4 says:


   An object whose names are all unique is interoperable in the sense
   that all software implementations receiving that object will agree on
   the name-value mappings.  When the names within an object are not
   unique, the behavior of software that receives such an object is
   unpredictable.  Many implementations report the last name/value pair
   only.  Other implementations report an error or fail to parse the
   object, and some implementations report all of the name/value pairs,
   including duplicates.



This topic has been heavily discussed by the working group, and while the specs used to just say that objects with duplicate member names MUST be rejected, working group members, including Tim Bray (the editor of the JSON spec), prevailed on us to weaken this so that parsers that implement the ECMAscript behavior of returning only the last member name may be legally used.  (The argument was made that there was more security downside in effectively requiring people to write and debug their own strict parsers than in using laxer, but well-supported and debugged parsers.)



However, we also intentionally require that producers use only one instance of each member name, so that legally produced objects will never exercise the ambiguities that are present in real JSON parsers.  That seemed to be the most practical solution to the working group.


[snip]
                                                            Thanks again, Stephen,
                                                            -- Mike


_______________________________________________
jose mailing list
jose@ietf.org<mailto:jose@ietf.org>
https://www.ietf.org/mailman/listinfo/jose



--

Best regards,
Kathleen



--

Best regards,
Kathleen

_______________________________________________
jose mailing list
jose@ietf.org<mailto:jose@ietf.org>
https://www.ietf.org/mailman/listinfo/jose



--
- Tim Bray (If you’d like to send me a private message, see https://keybase.io/timbray)