Re: [OAUTH-WG] Token Mediating and session Information Backend For Frontend (TMI BFF)

Warren Parad <wparad@rhosys.ch> Sun, 14 February 2021 12:24 UTC

Return-Path: <wparad@rhosys.ch>
X-Original-To: oauth@ietfa.amsl.com
Delivered-To: oauth@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 3B8EB3A08ED for <oauth@ietfa.amsl.com>; Sun, 14 Feb 2021 04:24:57 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.188
X-Spam-Level:
X-Spam-Status: No, score=-0.188 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_KAM_HTML_FONT_INVALID=0.01, URIBL_BLOCKED=0.001] autolearn=unavailable autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=rhosys.ch
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 adxzmt7jTxus for <oauth@ietfa.amsl.com>; Sun, 14 Feb 2021 04:24:54 -0800 (PST)
Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) (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 3CFEC3A08E4 for <oauth@ietf.org>; Sun, 14 Feb 2021 04:24:54 -0800 (PST)
Received: by mail-il1-x133.google.com with SMTP id o15so3294842ilt.6 for <oauth@ietf.org>; Sun, 14 Feb 2021 04:24:54 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rhosys.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OclN/02U9L18x4KEm+dcPJazdix8udoTSq/HuKj6z2M=; b=PS6OcHsbR1zvKDtqNchNgp0MTC+7lw/3gLvVnd31KDKtSBZrVtvZg2+/YCqOpArjec jKrzTZSDg0vrldT62KaibbzG4gpQJo5AQ8+1HybMerUItGykhnMW90OLwWS7RqjJXT8b P27i2tcDKxYISm75V8ZZFCuuV63QeMRHl6a4xghwvrYr/6tbCyFUtj0wxRyKugLXdWqS thzXX7LIwIek0qazzct2RwwQV4b4C8tqaaaZr3EgkldSveyIaLB1+Ztft0jrM8b6tMEr UBrcuy6Hcqhvpez9Yxn18a3fCmmvTzw+654XoSI6kimkhTz63LVLlM8PGEwp+g4SiGFe 7nzQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OclN/02U9L18x4KEm+dcPJazdix8udoTSq/HuKj6z2M=; b=Gb5F42p2elEmMjtdntX+ycxo5OVJPNkDEgtAh/D4VuU5rfmBunIAmz5RgtqJioJv8m ySEj9OP8Jw/F8qir26l1nXlMW1OTuJyQ+jLsl0dWHeDEO2Jl+TgiAFiPl0BrXlc5qATD mVP/kJhTmvZ7dJBWP9EOf0ynUm6fHyKZdJRCegCxqHNSqJHzWORc/ChBLEjLZVj/3Bo8 8yF8yeGU+UMEwgsFX2jIFTm7ymOc4HdZyxjTeRbXfoSRdippuFnmnMt5M3BcVTZxrEjO wHeFj/2xryBpMFr41a1gjPinoccKRAdoDbKSuiqallqIDhrfqdTh7Jj19dHfHEhSknKy KjBQ==
X-Gm-Message-State: AOAM532xNWh/FVejcAj++AylaDQCLgAO2iIuZbvX+DjOs5IBrydMdrjH nZLDaZhFmTA+BilZVsd1PqXS2/NZIcs7DieVDcIm
X-Google-Smtp-Source: ABdhPJx1xcFa8Z7IbamUD5pK7vYBluqB7SA65WAYgb0xSMDOqFolN632WQ90wqT3VoL3S1euw1/oh0T0+EfJLXojoNs=
X-Received: by 2002:a05:6e02:1d0e:: with SMTP id i14mr8632933ila.69.1613305493293; Sun, 14 Feb 2021 04:24:53 -0800 (PST)
MIME-Version: 1.0
References: <CO6PR18MB4052805653BFECD35E8A0E66AE8B9@CO6PR18MB4052.namprd18.prod.outlook.com> <CAO7Ng+vWgx1yFBqeTEy8pkUsqFjyyBuESzteobhfqYAVqbVWWA@mail.gmail.com>
In-Reply-To: <CAO7Ng+vWgx1yFBqeTEy8pkUsqFjyyBuESzteobhfqYAVqbVWWA@mail.gmail.com>
From: Warren Parad <wparad@rhosys.ch>
Date: Sun, 14 Feb 2021 13:24:42 +0100
Message-ID: <CAJot-L30v4pGMR==AQitnCbUkQXfdUW+EACybcCak1LqH+CDPg@mail.gmail.com>
To: Dominick Baier <dbaier@leastprivilege.com>
Cc: Vittorio Bertocci <vittorio.bertocci=40auth0.com@dmarc.ietf.org>, Brian Campbell <bcampbell@pingidentity.com>, "oauth@ietf.org" <oauth@ietf.org>
Content-Type: multipart/alternative; boundary="000000000000d7ac8f05bb4af4fc"
Archived-At: <https://mailarchive.ietf.org/arch/msg/oauth/hjte84Uj8Hc6ZDifkDRKb61P0Ek>
Subject: Re: [OAUTH-WG] Token Mediating and session Information Backend For Frontend (TMI BFF)
X-BeenThere: oauth@ietf.org
X-Mailman-Version: 2.1.29
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: <https://mailarchive.ietf.org/arch/browse/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: Sun, 14 Feb 2021 12:24:57 -0000

>
> My biggest concern with browser-based applications is that the JavaScript
> / browser has access to the access token (don’t care if it is in-memory or
> local storage) - but this exactly seems to happen in D.

Unless the AS passes the token back in a HttpOnly cookie (which Oauth
doesn't technically support) it will always be available to Javascript in
browser, right?

Warren Parad

Founder, CTO
Secure your user data and complete your authorization architecture.
Implement Authress <https://authress.io>.


On Sun, Feb 14, 2021 at 1:06 PM Dominick Baier <dbaier@leastprivilege.com>
wrote:

> Hi,
>
> Just making sure I understand - in your protocol flow diagram step D it
> looks like that the BFF is returning the access token to the front-end. Is
> that correct?
>
> My biggest concern with browser-based applications is that the JavaScript
> / browser has access to the access token (don’t care if it is in-memory or
> local storage) - but this exactly seems to happen in D.
>
> Thanks
> ———
> Dominick Baier
>
> On 12. February 2021 at 21:46:20, Vittorio Bertocci (
> vittorio.bertocci=40auth0.com@dmarc.ietf.org) wrote:
>
> Dear all,
> Brian and yours truly are proposing a new specification that shows how the
> user agent frontend of a web app can delegate token acquisition and
> persistence to its backend, and request such tokens when needed for direct
> access of protected resources from the frontend code.
>
> The pattern is already in use, in proprietary form, by various modern
> development stacks, such as Next.JS. Variants of the pattern, often
> discussed under the catch-all term BFF (backend for frontend), have been
> often mentioned in this workgroup’s activity, but always left all
> implementation details to the reader.
> We believe the pattern has merit, as corroborated by its growing adoption.
> By delegating access token acquisition to the backend, we avoid many of the
> often brittle moving parts (and implied attack surface) required to acquire
> access tokens from a user agent. The topology also relieves the frontend
> from the need of persisting tokens in local storage, a well known sore
> point of using OAuth directly in JavaScript, by relying on its backend
> storage and session to preserve tokens.
>
> Although the specification is very simple, providing explicit guidance on
> the scenario offers many advantages.
> - It makes it possible to create interoperable SDKs, where frontend dev
> stacks (any JS flavor) can be mixed and matched with compliant backend
> stacks (middlewares in node, java, ASP.NET, PHP etc)
> - It allows us to provide guidance on how to properly tackle the scenario
> and warn implementers against security risks (scope escalations, using
> IDtokens instead of access tokens, etc)
> - It allows us to discuss (and when appropriate, promote) this pattern as
> part of the browser apps security guidance, and position the scenario where
> frontend only calls API on its own backed (hence doesn’t need access
> tokens) simply as a special case of this more general pattern
> - This approach makes mocking and testing apps very easy, possibly
> preventing developers from weakening the security of their system (eg
> turning on ROPG options) or turning to risky practices like scraping
>
> Needless to say, this specification doesn’t entirely eliminate the risks
> inherent to direct use of access tokens from a browser. But reality is that
> the pattern is in widespread use, and the circumstances leading to that (eg
> developers on a particular project only work with frontend stacks;
> components like reverse proxies might not always be viable; etc) aren’t
> going away any time soon. By providing simple guidance on this pattern, we
> can simplify the life of many developers while enshrining basic security
> hygiene in scenarios that would have otherwise be left to their own device.
>
> Looking forward for your feedback!
>
> B&V
>
> On 2/12/21, 12:41, "internet-drafts@ietf.org" <internet-drafts@ietf.org>
> wrote:
>
>
> A new version of I-D, draft-bertocci-oauth2-tmi-bff-00.txt
> has been successfully submitted by Vittorio Bertocci and posted to the
> IETF repository.
>
> Name: draft-bertocci-oauth2-tmi-bff
> Revision: 00
> Title: Token Mediating and session Information Backend For Frontend
> Document date: 2021-02-12
> Group: Individual Submission
> Pages: 16
> URL: https://www.ietf.org/archive/id/draft-bertocci-oauth2-tmi-bff-00.txt
> Status: https://datatracker.ietf.org/doc/draft-bertocci-oauth2-tmi-bff/
> Html:
> https://www.ietf.org/archive/id/draft-bertocci-oauth2-tmi-bff-00.html
> Htmlized: https://tools.ietf.org/html/draft-bertocci-oauth2-tmi-bff-00
>
>
> Abstract:
> This document describes how a JavaScript frontend can delegate access
> token acquisition to a backend component. In so doing, the frontend
> can access resource servers directly without taking on the burden of
> communicating with the authorization server, persisting tokens, and
> performing operations that are fraught with security challenges when
> executed in a user agent, but are safe and well proven when executed
> by a confidential client running on a backend.
>
>
>
>
> Please note that it may take a couple of minutes from the time of
> submission
> until the htmlized version and diff are available at tools.ietf.org.
>
> The IETF Secretariat
>
>
>
> _______________________________________________
> 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
>