Re: [OAUTH-WG] application/x-www-form-urlencoded vs JSON

Marius Scurtescu <mscurtescu@google.com> Tue, 20 April 2010 16:40 UTC

Return-Path: <mscurtescu@google.com>
X-Original-To: oauth@core3.amsl.com
Delivered-To: oauth@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id B1D173A6AAB for <oauth@core3.amsl.com>; Tue, 20 Apr 2010 09:40:40 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -105.893
X-Spam-Level:
X-Spam-Status: No, score=-105.893 tagged_above=-999 required=5 tests=[AWL=0.084, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, RCVD_IN_DNSWL_MED=-4, USER_IN_WHITELIST=-100]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6++ZZLrSgQ32 for <oauth@core3.amsl.com>; Tue, 20 Apr 2010 09:40:39 -0700 (PDT)
Received: from smtp-out.google.com (smtp-out.google.com [216.239.44.51]) by core3.amsl.com (Postfix) with ESMTP id 659703A6944 for <oauth@ietf.org>; Tue, 20 Apr 2010 09:40:39 -0700 (PDT)
Received: from hpaq13.eem.corp.google.com (hpaq13.eem.corp.google.com [10.3.21.13]) by smtp-out.google.com with ESMTP id o3KGeSBI019804 for <oauth@ietf.org>; Tue, 20 Apr 2010 09:40:29 -0700
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1271781630; bh=X5dWDRuGhABwOKGaSM2aLQjtMXc=; h=MIME-Version:In-Reply-To:References:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=r6qLmE5dv1ll3iD4fIm8Q4mtw7XO2F3EgMctshu2DYgUowQAaYuzvo7OonHKYRMa7 5cCTGbXZxPtXiQR0baUqg==
DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=mime-version:in-reply-to:references:from:date:message-id: subject:to:cc:content-type:x-system-of-record; b=fwaJg/QWyITaohxoBtRla7YVVS9xgNTqiyiAmavy/rL3nHMwwxbN3n3mYCGcJGVTy 4ej3ijJzaVVFkGU6jBmxQ==
Received: from pzk30 (pzk30.prod.google.com [10.243.19.158]) by hpaq13.eem.corp.google.com with ESMTP id o3KGeQe8030391 for <oauth@ietf.org>; Tue, 20 Apr 2010 18:40:27 +0200
Received: by pzk30 with SMTP id 30so3628503pzk.12 for <oauth@ietf.org>; Tue, 20 Apr 2010 09:40:26 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.141.107.2 with HTTP; Tue, 20 Apr 2010 09:40:06 -0700 (PDT)
In-Reply-To: <w2lc334d54e1004200927k3c599ab9tf84aa04d2ce8a007@mail.gmail.com>
References: <9890332F-E759-4E63-96FE-DB3071194D84@gmail.com> <90C41DD21FB7C64BB94121FBBC2E723438E30A379B@P3PW5EX1MB01.EX1.SECURESERVER.NET> <20100419134825.134951nuzvi35hk4@webmail.df.eu> <90C41DD21FB7C64BB94121FBBC2E723438E5C7F45E@P3PW5EX1MB01.EX1.SECURESERVER.NET> <t2wc334d54e1004200924ja0e7786u9b349a1931098f2a@mail.gmail.com> <w2lc334d54e1004200927k3c599ab9tf84aa04d2ce8a007@mail.gmail.com>
From: Marius Scurtescu <mscurtescu@google.com>
Date: Tue, 20 Apr 2010 09:40:06 -0700
Received: by 10.141.15.4 with SMTP id s4mr1948124rvi.112.1271781626112; Tue, 20 Apr 2010 09:40:26 -0700 (PDT)
Message-ID: <w2p74caaad21004200940t7bbf5153g605508cf3a07984@mail.gmail.com>
To: jsmarr@stanfordalumni.org
Content-Type: text/plain; charset="ISO-8859-1"
X-System-Of-Record: true
Cc: OAuth WG <oauth@ietf.org>
Subject: Re: [OAUTH-WG] application/x-www-form-urlencoded vs JSON
X-BeenThere: oauth@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: OAUTH WG <oauth.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/oauth>, <mailto:oauth-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/oauth>
List-Post: <mailto:oauth@ietf.org>
List-Help: <mailto:oauth-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/oauth>, <mailto:oauth-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 20 Apr 2010 16:40:40 -0000

How about encoding requests as well. The request json blob could be
then URL encoded and added to the endpoint/callback URL with a
parameter like "oauth_json_request". This would solve the
prefix/collision problem.

Marius



On Tue, Apr 20, 2010 at 9:27 AM, Joseph Smarr <jsmarr@gmail.com> wrote:
> ...and of course by "request format", I mean "response format". :)
> BTW, note that the "trailing newline problem" with url-encoding is
> particularly pernicious because a) it messes up the signature, and b) you
> often can't see it when you print out your variables, so everything looks ok
> and yet the signature is garbled. I've seen this multiple times, and IMO
> that alone is reason enough to get rid of this serialization format in favor
> of something more robust and widely implemented like JSON.
>
> On Tue, Apr 20, 2010 at 9:24 AM, Joseph Smarr <jsmarr@gmail.com> wrote:
>>
>> +1 to including JSON format, and perhaps making it the required format. In
>> my experience helping numerous developers debug their OAuth implementations,
>> url-encoding/decoding was often a source of bugs, since a) the libraries are
>> usually hand-built, b) url-encoding is known to be funky/inconsistent wrt +
>> vs. %20 and other such things, and c) it's very sensitive to things like a
>> trailing newline at the end of the response, which can easily be tokenized
>> as part of the the last value (since the normal implementations just split
>> on & and =). In contrast, I've never heard of any problems parsing JSON, nor
>> any encoding/decoding bugs related to working with JSON in other APIs
>> (something I *cannot* say about XML, which is way more finicky about
>> requiring its values to be properly encoded or escaped in CDATA etc.; I've
>> also seen way more inconsistency in support of XML parsers and their output
>> formats, whereas JSON always works exactly the same way and always "just
>> works").
>> So in conclusion, url-encoding has caused a lot of pain in OAuth 1.0, and
>> JSON is already widely supported (presumably including by most APIs that
>> you're building OAuth support to be able to access!), so I think it would
>> simplify the spec and increase ease/success of development to use JSON as a
>> request format. In fact, I think I'd like to push for it to be the
>> default/required format, given the positive attributes above. Does anyone
>> object, and if so, why?
>> Thanks, js
>>
>> On Tue, Apr 20, 2010 at 8:10 AM, Eran Hammer-Lahav <eran@hueniverse.com>
>> wrote:
>>>
>>> There seems to be support for this idea with some concerns about
>>> complexity. Someone needs to propose text for this including defining the
>>> request parameter and schema of the various reply formats.
>>>
>>> EHL
>>>
>>> > -----Original Message-----
>>> > From: Torsten Lodderstedt [mailto:torsten@lodderstedt.net]
>>> > Sent: Monday, April 19, 2010 4:48 AM
>>> > To: Eran Hammer-Lahav
>>> > Cc: Dick Hardt; OAuth WG
>>> > Subject: Re: [OAUTH-WG] application/x-www-form-urlencoded vs JSON
>>> >
>>> >
>>> > > We can also offer both and define a client request parameter (as long
>>> > > as the server is required to make at least one format available).
>>> >
>>> > +1 on this
>>> >
>>> > regards,
>>> > Torsten.
>>> >
>>> > >
>>> > > EHL
>>> > >
>>> > >> -----Original Message-----
>>> > >> From: oauth-bounces@ietf.org [mailto:oauth-bounces@ietf.org] On
>>> > >> Behalf Of Dick Hardt
>>> > >> Sent: Sunday, April 18, 2010 9:30 PM
>>> > >> To: OAuth WG
>>> > >> Subject: [OAUTH-WG] application/x-www-form-urlencoded vs JSON
>>> > >>
>>> > >> The AS token endpoint response is encoded as application/x-www-form-
>>> > >> urlencoded
>>> > >>
>>> > >> While this reuses a well known and understood encoding standard, it
>>> > >> is uncommon for a client to receive a message encoded like this.
>>> > >> Most
>>> > >> server responses are encoded as XML or JSON. Libraries are NOT
>>> > >> reedily available to parse application/x-www-form-urlencoded results
>>> > >> as this is something that is typically done in the web servers
>>> > >> framework. While parsing the name value pairs and URL un-encoding
>>> > >> them is not hard, many developers have been caught just splitting
>>> > >> the
>>> > parameters and forgetting to URL decode the token.
>>> > >> Since the token is opaque and may contain characters that are
>>> > >> escaped, it is a difficult bug to detect.
>>> > >>
>>> > >> Potential options:
>>> > >>
>>> > >> 1) Do nothing, developers should read the specs and do the right
>>> > >> thing.
>>> > >>
>>> > >> 2) Require that all parameters are URL safe so that there is no
>>> > >> encoding issue.
>>> > >>
>>> > >> 3) Return results as JSON, and recommend that parameters be URL
>>> > >> safe.
>>> > >>
>>> > >> -- Dick
>>> > >> _______________________________________________
>>> > >> OAuth mailing list
>>> > >> OAuth@ietf.org
>>> > >> https://www.ietf.org/mailman/listinfo/oauth
>>> > > _______________________________________________
>>> > > OAuth mailing list
>>> > > OAuth@ietf.org
>>> > > https://www.ietf.org/mailman/listinfo/oauth
>>> > >
>>> >
>>> >
>>> >
>>>
>>> _______________________________________________
>>> OAuth mailing list
>>> OAuth@ietf.org
>>> https://www.ietf.org/mailman/listinfo/oauth
>>
>
>
> _______________________________________________
> OAuth mailing list
> OAuth@ietf.org
> https://www.ietf.org/mailman/listinfo/oauth
>
>