Re: [Json] Proposed rechartering for the JSON WG

Phillip Hallam-Baker <hallam@gmail.com> Mon, 10 February 2014 18:10 UTC

Return-Path: <hallam@gmail.com>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 220FB1A00EE for <json@ietfa.amsl.com>; Mon, 10 Feb 2014 10:10:26 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.999
X-Spam-Level:
X-Spam-Status: No, score=-1.999 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=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 WNEIqQIs_8gq for <json@ietfa.amsl.com>; Mon, 10 Feb 2014 10:10:23 -0800 (PST)
Received: from mail-lb0-x230.google.com (mail-lb0-x230.google.com [IPv6:2a00:1450:4010:c04::230]) by ietfa.amsl.com (Postfix) with ESMTP id A431E1A01E8 for <json@ietf.org>; Mon, 10 Feb 2014 10:10:21 -0800 (PST)
Received: by mail-lb0-f176.google.com with SMTP id w7so5056219lbi.35 for <json@ietf.org>; Mon, 10 Feb 2014 10:10:20 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=IxUWioZxS29ArwWM9iUdBOk25nuJI0BIJORdvoeDG/o=; b=oIfR5BODtS0xT5hm6XCl9SoJwTsNjyM7Xj932a/akzVHbYIQX3BNq2tizpd5yucN69 HLY1fC3m3BRJHsArLS1jCoTjiwVKm6NzafxvPOGLAfO0CVW/qn6/9555VnU4e9zE/zpO l/DaxNswyQIrZxbv0vYyfdexkka+176Fbjpuj0GGohOF+b7c2MV7aCyLJQ7muzWAwLkk HqOa3Fy+2GvR8E6N+iDH4Pi5NT6Ef8xosTHD2MtIyKw82RTKg0ILpApkA17rOyqkRzU4 loc/i6jzeyladsqlbamfDsn5pNi2hKw3AMAMwCStnqqpFhmVRoewgRcJNhq6vhfz8T+X 5ogQ==
MIME-Version: 1.0
X-Received: by 10.112.171.194 with SMTP id aw2mr2400264lbc.46.1392055820731; Mon, 10 Feb 2014 10:10:20 -0800 (PST)
Received: by 10.112.37.168 with HTTP; Mon, 10 Feb 2014 10:10:20 -0800 (PST)
In-Reply-To: <CAK3OfOj6uU_+NE0Q+P+MxoeyW_Gfpx50-UOHAJaFN10ygmqXDg@mail.gmail.com>
References: <52D9B39C.5020102@cisco.com> <1C1347D2-0D99-4D49-B4C1-199246167D23@vpnc.org> <CAMm+Lwj0phrmP563tBbZJKHeYw=Azh1as6GZOA6rANPpC6PJgA@mail.gmail.com> <CAHBU6iv+-9xQYAjZdfZk7+GeA6J+sjaV5era3L+PiJ9RoauBYg@mail.gmail.com> <CAMm+Lwh0O4+iuaJMUhYgj+0GS8e9b_nZtNNX91hOmjUypsgkTQ@mail.gmail.com> <CAK3OfOhu0GZY9CVQrqD4SyjHLVEoEg1DtYj_6imZbbHtzX2eEw@mail.gmail.com> <CAHBU6iuR0MPm9q483jBMqTRkGV1f2giGNhp+UciQ7rRnrvcEBA@mail.gmail.com> <CAK3OfOj7Ti+rRGXXdMQwFvErUrbG34N8Wn0JqGhaKBA4=ri-nA@mail.gmail.com> <CAHBU6isUs76sXdcH5gNMrZKr4XpcZdEziHjrHzUpHDvKXcvyWg@mail.gmail.com> <CAK3OfOj6uU_+NE0Q+P+MxoeyW_Gfpx50-UOHAJaFN10ygmqXDg@mail.gmail.com>
Date: Mon, 10 Feb 2014 13:10:20 -0500
Message-ID: <CAMm+Lwg+gcdpH8Q1D1RZxykJt+FiTyQX+ao1jW+7z3=7UrJQoQ@mail.gmail.com>
From: Phillip Hallam-Baker <hallam@gmail.com>
To: Nico Williams <nico@cryptonector.com>
Content-Type: multipart/alternative; boundary="001a11c36e84b3cc1704f21140a6"
Cc: Tim Bray <tbray@textuality.com>, Paul Hoffman <paul.hoffman@vpnc.org>, "json@ietf.org" <json@ietf.org>
Subject: Re: [Json] Proposed rechartering for the JSON WG
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <json.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/json>, <mailto:json-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/json/>
List-Post: <mailto:json@ietf.org>
List-Help: <mailto:json-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/json>, <mailto:json-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 10 Feb 2014 18:10:26 -0000

On Mon, Feb 10, 2014 at 12:43 PM, Nico Williams <nico@cryptonector.com>wrote:

> On Sat, Feb 8, 2014 at 5:52 PM, Tim Bray <tbray@textuality.com> wrote:
> > On Sat, Feb 8, 2014 at 2:50 PM, Nico Williams <nico@cryptonector.com>
> wrote:
> >>
> >>
> >> An XPath/XSLT for JSON would be good.  There's a great candidate for
> >> that: http://stedolan.github.io/jq .
> >
> >
> > jq seems like overkill. Wow, would it ever be easy to do a JSON path
> > selector.   They practically read themselves
> >
> > "buffer"/"size"
>
> FYI:
>
> .buffer.size
>
> > //"size"
>
> recurse(.[]).size
>
> > //"buffers"/./"size"
>
> recurse(.[]).buffers[].size
>
> > //"buffers"/0/"size"
>
> recurse(.[]).buffers[0].size
>
> The .name syntax is a bit to type-strong and so you get spurious error
> messages (safely ignored).  I think the right thing to do here is to
> make .name act like 'empty' when . is not an object, or if name is an
> integer, when . is not an array (but .[number] needs to continue to
> produce warnings if . is not an array).  That and add ..name syntax,
> then '..buffers.0.size' should do what you want without spurious error
> messages.  I'll defer to Stephen either way.
>
> BTW, I've needed // in XPath very often.  But I've never needed it
> when dealing with JSON data.  The JSON data I've dealt with never had
> more than one layer of structure repetition, while XML data I've dealt
> with had many.
>
> > //"buffers"/-1/.
>
> This one's a pain as jq doesn't do negative indices, so you have -1 the
> length.
>
> > "buffer"/./"key"
>


One area I would very much like to standardize on is limits like the above.
I write my code so that the decoder can cope with messages of any size and
arbitrary depth, up to the maximum that the machine can take. But that is
obviously neither needed nor acceptable for a production machine.

Someone writing a JSON spec should specify what their limits are so that a
parser implementation can reject DoS attacks early and block future
requests from that IP.

It is also an efficiency consideration in C. If I know that no request will
ever be more than 64KB long or be nested more than 10 deep, I can
pre-allocate all the necessary structures along with the socket and they
can be cleared and reused or freed as one unit depending on the load of the
server at the time. Avoiding multiple malloc calls is a good way to make a
server fly.


-- 
Website: http://hallambaker.com/