Re: [Json] Go JSON parser ignores the case of member names

Anders Rundgren <anders.rundgren.net@gmail.com> Wed, 09 March 2016 22:28 UTC

Return-Path: <anders.rundgren.net@gmail.com>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 9BE4412D84C for <json@ietfa.amsl.com>; Wed, 9 Mar 2016 14:28:59 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.7
X-Spam-Level:
X-Spam-Status: No, score=-2.7 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, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=unavailable autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
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 KnNEwRAZa62c for <json@ietfa.amsl.com>; Wed, 9 Mar 2016 14:28:56 -0800 (PST)
Received: from mail-wm0-x233.google.com (mail-wm0-x233.google.com [IPv6:2a00:1450:400c:c09::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2295A12DADE for <json@ietf.org>; Wed, 9 Mar 2016 14:13:31 -0800 (PST)
Received: by mail-wm0-x233.google.com with SMTP id n186so5047889wmn.1 for <json@ietf.org>; Wed, 09 Mar 2016 14:13:31 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=RjnwwbMOkAeJtXypuk6RvrlrTahm6WMFKG9BUYgwKX8=; b=b/fl3dU+GDFsK1jXg59ifZ/8RVkzI6mmT5K4W8BAAD9T6WseTSdx+WYONqoNFQVPiz 7QomdY7s56+xzJky2z2fT0vqCWD+Im/NpnKWUZf24y9wQ9xEfv/+EKxa/YiiCRyqzQWA nwjmM8OBm4nMiMt9c3ZNDclt4FwAi6DZTim1Zmr+85uRPsDDM2O6+j2eZi/jIT4pahtE mownGMXklTCAIz05oYoPK4RvqChyYZAdm2xJqXZFFFYBSg5RSQe6/GNeXXlFEb81GScJ MFeg9CeE39tYh1DF7hfjqXIP738mMQoP5KQhXb2PrEYsWcpB+YBy1qbT+rUzQOJ5pd4l oDAw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=RjnwwbMOkAeJtXypuk6RvrlrTahm6WMFKG9BUYgwKX8=; b=IxznaiPKOcSbgVgQJMvbxD0nNqv2qgh2+OfmogEERo3Pe3QyImyoWkv/QpPsR2tCz3 bHAmpg/v3CzjSrqv56WbT8GAy/vqHvlmU+YaDB2XwXz2DcZRy6rjigAkAhLN/XdugnuL HG5WAPi45vnbds2C3ZJVNpel/hloG1JmGAIsL3dnBu0J+4eVOVFtpN+1qE9j/dmG+4c+ QqbZzxucgj0+YKVUJkAzE4PLYdxPn0LOZQJBhPurpQymXs4xcMlTibXnRE9xQw6+Ddxo gh01OCGkVd+zlKPEIFmroEhfWbeX6eqX+qCMiIaDAiweGUy8PPJ8fZg7CKRGWbkWWHkP oK2A==
X-Gm-Message-State: AD7BkJKKYNh4yuCDSON3w5pRIOPaqZfdK53U8+dzWI/Mp+pVrSQLOu6jIBDfJxzmrs/vRg==
X-Received: by 10.194.71.135 with SMTP id v7mr42599wju.135.1457561609817; Wed, 09 Mar 2016 14:13:29 -0800 (PST)
Received: from [192.168.1.79] (83.203.130.77.rev.sfr.net. [77.130.203.83]) by smtp.googlemail.com with ESMTPSA id w125sm566413wmw.18.2016.03.09.14.13.28 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 09 Mar 2016 14:13:29 -0800 (PST)
To: John Cowan <cowan@mercury.ccil.org>, Rob Sayre <sayrer@gmail.com>
References: <255B9BB34FB7D647A506DC292726F6E13BBE5873A1@WSMSG3153V.srv.dir.telstra.com> <20160309012028.GQ32247@mercury.ccil.org> <CAChr6SyGoRO-CgH5cPSXLLhnqkd5kJb9XpJ-evgJ1kB=mUot9A@mail.gmail.com> <20160309213830.GB9515@mercury.ccil.org>
From: Anders Rundgren <anders.rundgren.net@gmail.com>
Message-ID: <56E09FE8.9000807@gmail.com>
Date: Wed, 9 Mar 2016 23:12:56 +0100
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0
MIME-Version: 1.0
In-Reply-To: <20160309213830.GB9515@mercury.ccil.org>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Archived-At: <http://mailarchive.ietf.org/arch/msg/json/iOufeQ2W4dks0eSbbZuHEiR5u3Y>
Cc: "Manger, James" <James.H.Manger@team.telstra.com>, "json@ietf.org" <json@ietf.org>
Subject: Re: [Json] Go JSON parser ignores the case of member names
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.17
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: <https://mailarchive.ietf.org/arch/browse/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: Wed, 09 Mar 2016 22:29:00 -0000

On 2016-03-09 22:38, John Cowan wrote:
> Rob Sayre scripsit:
>
>> Well, there are ways to avoid it too (see below). I see it more as an
>> object-mapper convenience than a JSON conformance problem. I imagine object
>> mapping libraries in other languages have this feature too.
>
> The problem arises in cases like this: Suppose the spec says that key
> "alg" specifies the name of the algorithm, and defaults to "none" if
> there is no key.  Then if the upstream provider sends {"typ" : "JWS",
> "ALG": "HS256"}, then a receiver written in Go will see the algorithm
> as HS256,

Which indeed is bad.

> whereas any other receiver will see the algorithm as "none".
> That's almost certainly not the desired result.

Using a RealJSONParser(tm) other receivers will rather choke on the message
and complain about an unexpected "ALG" property.

I'm just in the process adding such a facility to node.js:
https://github.com/cyberphone/node-webpki.org/blob/master/lib/jsonutil.js


Anders