Re: [OAUTH-WG] Defining a maximum token length?

David Recordon <recordond@gmail.com> Wed, 10 March 2010 03:50 UTC

Return-Path: <recordond@gmail.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 E30DD3A681A for <oauth@core3.amsl.com>; Tue, 9 Mar 2010 19:50:29 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599]
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 vUMJj-p2fEWJ for <oauth@core3.amsl.com>; Tue, 9 Mar 2010 19:50:29 -0800 (PST)
Received: from mail-iw0-f180.google.com (mail-iw0-f180.google.com [209.85.223.180]) by core3.amsl.com (Postfix) with ESMTP id DD3543A67E1 for <oauth@ietf.org>; Tue, 9 Mar 2010 19:50:28 -0800 (PST)
Received: by iwn10 with SMTP id 10so1576052iwn.31 for <oauth@ietf.org>; Tue, 09 Mar 2010 19:50:33 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=x1kWEW2k0kJLxlyx47JNAOBtjFpoknqhThu7aCk+w1c=; b=uS3I6g6tR90p/tzvnuyp0P+mHwMCGOHsbIGsWzPpnecVuPXyNNJUGaYlfnDro+NIsq 7CVATP5Bcfn7Dh02MotJ+8banU5V6+AnN9NW5KLhBCY5B2UGP2ZwocnYFag56lrw9pIR v9nfoQ3fALIO64vbg1/+oFrV+q+AcNswJyo1c=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=FXqiWqa3PlMMpPMsNcT4WjckhrkmZa+osSUlVfbQkWnFmXprilMs/uOoMbdZ825Fpu R1WWbQLREtS28UX603R+1+nh3HECI1lXWbEn7FOowg+xunIb0RVb+6JgqVsojb0IZbVv OIY6aYZ/QG8X9nGLkdjf0kqDeRurz7aFv81+Q=
MIME-Version: 1.0
Received: by 10.231.168.133 with SMTP id u5mr384071iby.29.1268193033248; Tue, 09 Mar 2010 19:50:33 -0800 (PST)
In-Reply-To: <74caaad21003091925x7aeac395uac5ad816c543771e@mail.gmail.com>
References: <fd6741651003091550t5a464496r57aae9a60c516599@mail.gmail.com> <74caaad21003091623i8b7c343jc3bb806fe327492d@mail.gmail.com> <12ED1FAC-B9C6-47C1-AC01-AB33D110EF8C@gmail.com> <68f4a0e81003091824n5453cf4cp151f313de5fd9c5e@mail.gmail.com> <fd6741651003091916o4c3b3a3ao4dc7871ddf7df23b@mail.gmail.com> <74caaad21003091925x7aeac395uac5ad816c543771e@mail.gmail.com>
Date: Tue, 09 Mar 2010 19:50:33 -0800
Message-ID: <fd6741651003091950w682db38ct257caf2dfc8e5855@mail.gmail.com>
From: David Recordon <recordond@gmail.com>
To: Marius Scurtescu <mscurtescu@google.com>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
Cc: OAuth WG <oauth@ietf.org>
Subject: Re: [OAUTH-WG] Defining a maximum token length?
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: Wed, 10 Mar 2010 03:50:30 -0000

On Tue, Mar 9, 2010 at 7:25 PM, Dick Hardt <dick.hardt@gmail.com> wrote:
> I understand the desire to set a max length that can easily fit into a DB.
> There are lots of other items I think the developer is storing that can be
> long as well, like URLs -- so I don't see it as a huge issue.
> I do see the need to make it clear that it can be a few K or something like
> that so that people don't assume it is shorter than it might be.
> -- Dick

Why would the URLs be stored in a database?  Wouldn't they be in
configuration files given that OAuth doesn't support discovery of new
servers?  Yes, developers do store URLs in databases but it's
generally not very optimized.


On Tue, Mar 9, 2010 at 7:25 PM, Marius Scurtescu <mscurtescu@google.com> wrote:
> On Tue, Mar 9, 2010 at 7:16 PM, David Recordon <recordond@gmail.com> wrote:
>> The challenge is that client developers (who we really want to make
>> OAuth dead simple for) will be forced to use less optimal storage for
>> tokens (blobs versus shorter and indexable types such as varchars).
>> They also won't be able to build any assumptions around token length
>> into their database design.  Any DBA cringes when they see the blob
>> type for multiple columns within a table (access token and refresh
>> token per user).
>
> Why would you index the refresh token column? I think it is enough to
> lookup by user id and just retrieve the token.

Agreed, you shouldn't need to assuming that you only have one access
token per server/user combination.  Ignoring indicies, in MySQL a
varchar up to 255 characters takes one byte whereas a blob (or a
varchar over 255 characters) is the number of bytes for the string
plus two extra bytes.

In MySQL allowing tokens over 255 characters triples your storage
requirement in the best case. We're not talking about a lot of data
here, but it is worth noting that this design decision has a direct
impact on implementors.


> Also, quite likely that you don't need to store the access token in the
> SQL database at all and just make it a session attribute. Not sure what
> is reasonable for session data, a large set slows down replication, but
> a typical access token should be OK I think.

That's true if all access tokens expire frequently.  We plan to also
offer long lived access tokens.


>> Some OAuth servers will have short tokens which a client might
>> integrate with first and decide that a varchar(255) is reasonable to
>> hold tokens.  They'll then run across a server with longer tokens, not
>> realize it, and be confused why their client isn't working when it's
>> due to their database silently truncating tokens after 255 characters.
>
> Well, silently truncating data is a different issue altogether.

Sure, but standards can't just work in theory. :)


> Marius
>