Re: [OAUTH-WG] redircet_uri matching algorithm

Patrick Gansterer <paroga@paroga.com> Wed, 20 May 2015 20:35 UTC

Return-Path: <paroga@paroga.com>
X-Original-To: oauth@ietfa.amsl.com
Delivered-To: oauth@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id CF2BB1A90BD for <oauth@ietfa.amsl.com>; Wed, 20 May 2015 13:35:11 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.15
X-Spam-Level:
X-Spam-Status: No, score=-0.15 tagged_above=-999 required=5 tests=[BAYES_05=-0.5, HELO_EQ_DE=0.35] autolearn=no
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 AIbTO2AB2Eck for <oauth@ietfa.amsl.com>; Wed, 20 May 2015 13:35:10 -0700 (PDT)
Received: from mail.dynms.de (mail.dynms.de [85.25.184.156]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 3C17B1A90C6 for <oauth@ietf.org>; Wed, 20 May 2015 13:34:49 -0700 (PDT)
Received: from [10.10.10.101] (chello084112032036.1.11.vie.surfer.at [84.112.32.36]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.dynms.de (Postfix) with ESMTPSA id A4552546019F; Wed, 20 May 2015 22:34:47 +0200 (CEST)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\))
From: Patrick Gansterer <paroga@paroga.com>
In-Reply-To: <4D918E17-C0B6-425F-9A1C-F54DC83F730A@alkaline-solutions.com>
Date: Wed, 20 May 2015 22:34:46 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <BE354F56-1E6A-42B7-8C2B-493A18F07EE6@paroga.com>
References: <46886BA8-B8E1-494F-9F5D-4DB6AE0BEB99@paroga.com> <4D918E17-C0B6-425F-9A1C-F54DC83F730A@alkaline-solutions.com>
To: David Waite <david@alkaline-solutions.com>
X-Mailer: Apple Mail (2.2098)
Archived-At: <http://mailarchive.ietf.org/arch/msg/oauth/IHLg7HhQubK-Q51E7jkkXAy19DU>
X-Mailman-Approved-At: Thu, 28 May 2015 09:24:16 -0700
Cc: oauth@ietf.org
Subject: Re: [OAUTH-WG] redircet_uri matching algorithm
X-BeenThere: oauth@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: OAUTH WG <oauth.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/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, 20 May 2015 20:35:12 -0000

> On 20 May 2015, at 19:37, David Waite <david@alkaline-solutions.com> wrote:
> 
> 
>> On May 16, 2015, at 1:43 AM, Patrick Gansterer <paroga@paroga.com> wrote:
>> 
>> "OAuth 2.0 Dynamic Client Registration Protocol” [1] is nearly finished and provides the possibility to register additional “Client Metadata”.
>> 
>> OAuth 2.0 does not define any matching algorithm for the redirect_uris. The latest information on that topic I could find is [1], which is 5 years old. Is there any more recent discussion about it?
>> 
>> I’d suggest to add an OPTIONAL “redirect_uris_matching_method” client metadata. Possible valid values could be:
>> * “exact”: The “redirect_uri" provided in a redirect-based flow must match exactly one of of the provided strings in the “redirect_uris” array.
>> * “prefix”: The "redirect_uri" must begin with one of the “redirect_uris”. (e.g. "http://example.com/path/subpath” would be valid with [“http://example.com/path/“, “http://example.com/otherpath/”])
>> * “regex”: The provided “redirect_uris” are threatened as regular expressions, which the “redirect_uri” will be matched against. (e.g. “http://subdomain.example.com/path5/“ would be valid with [“^http:\\/\\/[a-z]+\\.example\\.com\\/path\\d+\\/“]
> 
> I don’t know if this is appropriate. For example, If a server is unwilling to support arbitrary regex matching, how would a client which required this be able to register dynamically? Or conversely: if a client did not require regex matching, why would they request this from a server?

The point is not that a client can register at every server in that case, but to know the (possible) (in)compatibility during registration already. Otherwise a client can only do an authentication request (which might not be possible when specific login-credentials are required) to check if the required redirect_uri_matching_algorithm is supported by the server.

> If a client requests regex or prefix, it was built to rely on these to work. If some set of servers choose not to support regex or prefix for scope or security reasons, this hurts interoperability from the perspective of dynamic registration. And we already have a workaround - instead make your client rely on the state parameter.

This is possible if there is a predefined list of redirect_uris. Imagine a services where every user gets his/her own subdomain, which all have a redirect_uri like https://user1.example.com/oauth/callback.
With the current concept every subdomain must be listed to get the OAuth stuff working on every subdomain.
Now not every subdomain under example.com should be required to register as a client, but only the TLD services hosted at example.com, example.net and example.org, which all have their own subdomains like https://user5.example.org.

There is for sure the possibility to have a central “OAuth gateway” e.g. at https://oauth.example.com/, witch only need to register one redirect_uri (e.g. https://oauth.example.com/oauth/callback), but would be  an additional dependency for the “user*”-subdomains, since they have to pass the OAuth request then to the “gateway".

> A client doing code or implicit should specify exact return URLs in their registration, and if they need to send the user someplace else after authentication it should be represented to the client by their state param.
> 
>> If not defined the server can choose any supported method, so we do not break existing implementations. On the other side it allows an client to make sure that a server supports a specific matching algorithm required by the client. ATM a client has no possibility to know how a server handles the redirect_uris.
> 
> The clients should be more than reasonably safe in assuming exact matching works. If the server won’t support exact matching on the redirect_uris supplied it should fail registration.

Since not all OAuth services do exact matching AFAIK, this would be an option to allow those services to tell their matching algorithm to the client.

—-
Patrick