Re: [OAUTH-WG] Feedback on OAuth for browser-based Apps

Dominick Baier <dbaier@leastprivilege.com> Thu, 25 July 2019 06:28 UTC

Return-Path: <dbaier@leastprivilege.com>
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 4F7CC1202B0 for <oauth@ietfa.amsl.com>; Wed, 24 Jul 2019 23:28:33 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.897
X-Spam-Level:
X-Spam-Status: No, score=-1.897 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=leastprivilege-com.20150623.gappssmtp.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 FYdcHuM1zvGc for <oauth@ietfa.amsl.com>; Wed, 24 Jul 2019 23:28:30 -0700 (PDT)
Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) (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 C560512028C for <oauth@ietf.org>; Wed, 24 Jul 2019 23:28:29 -0700 (PDT)
Received: by mail-qk1-x72f.google.com with SMTP id s145so35633650qke.7 for <oauth@ietf.org>; Wed, 24 Jul 2019 23:28:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leastprivilege-com.20150623.gappssmtp.com; s=20150623; h=from:in-reply-to:references:mime-version:date:message-id:subject:to :cc; bh=Do5kH8AI6yOxTvnmCSO2K5sHVYRbynIZIVNKMAffd8g=; b=kY3vVpZJPIZ+xvUHhGEnoVbgpz9qEghVAK+Ild90vYj6mzcEO+fDUc41HtdCXT2VyJ YJF6aIOhbt/LUr6SlAPn9ettcPuESGZlZE6Uyw35GePgWzOdAfs5KavSfdAsDxVpV2v1 XzU6hCuXy4ObBamNxremH/L5Ja1hfcP005ElxiBsIIn1MnuE+E5JuceoM6Ij6bbjjSoT RI0klSFEOPoKdgfw7z/u5xVzrZv7EL/JUR0au7hd2VHhE6UfK19HgJ0KA0QSu8mOg8XY puXKEaDFvZxCRBhwwHNqoSpvhWMWqmOHM/Ix64oD873kKec24flXXxeg/S/tVM4ljeJt ioZQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:in-reply-to:references:mime-version:date :message-id:subject:to:cc; bh=Do5kH8AI6yOxTvnmCSO2K5sHVYRbynIZIVNKMAffd8g=; b=g2b8jb3AdQ1WnwD0VYRQiV75EsdyG+b/Jn5T9Oe1H5+DWKKwzuJzqlsyZRiHM+6+TY 5TVn6ZCardldg5C5lm/ReoyeERmOn1EX3o00cB3bKTASDUJnw1IYASNVNwR3GqmJ90I1 FcmNzs4VFxLPbuLHN+azVrVC2AcYFFCCxU1kXtMXL6sD9UeKvJhV/d1C5lOGFXyDqAuX 7gHP1CuEkTUGjtCbMFV486FDyAPa21KzAy7mWSgxcVOHSr2pP1krGk9OZOepSng5oFsR R0E4N1pE1UnrCpvWSFZnxccL32TMoOnidchHbgMv3h4mMrV+5uOzBSPyHfwvKXehFebU oyqg==
X-Gm-Message-State: APjAAAWjQBQznoyi5iDYMkqoPdcTOrvfHT/xoaj7PM/vjsEzUeiMoF0n qjI6ABISovy5CcU4aY43pbKx+vjMTWgn8zxFVg==
X-Google-Smtp-Source: APXvYqxio/2RJpETvPj9hosWWC1gmhWplCytD5ISPiwibsmUU+AMP7dc2ythQt0nMXe1VXewV+GrQ7OsaiEbVrUSfvs=
X-Received: by 2002:a37:a292:: with SMTP id l140mr56510033qke.496.1564036108588; Wed, 24 Jul 2019 23:28:28 -0700 (PDT)
Received: from 1058052472880 named unknown by gmailapi.google.com with HTTPREST; Wed, 24 Jul 2019 23:28:27 -0700
From: Dominick Baier <dbaier@leastprivilege.com>
In-Reply-To: <CAGBSGjoexpLjzOcBV+wjH6+CtRROB1ZbPre+7DgfipsO1RgVOQ@mail.gmail.com>
References: <CAO7Ng+tyHaKQgJ4PcrcEpMcteqvdH2PE1CQP5j+5DqKJWuKPoQ@mail.gmail.com> <CAGBSGjoexpLjzOcBV+wjH6+CtRROB1ZbPre+7DgfipsO1RgVOQ@mail.gmail.com>
MIME-Version: 1.0
Date: Wed, 24 Jul 2019 23:28:27 -0700
Message-ID: <CAO7Ng+sdevJ3xrLjZVjnajJcnRzH9Q1p3Hio-4a00WsyEOAzWQ@mail.gmail.com>
To: Aaron Parecki <aaron@parecki.com>
Cc: OAuth WG <oauth@ietf.org>
Content-Type: multipart/alternative; boundary="000000000000ab4274058e7b887d"
Archived-At: <https://mailarchive.ietf.org/arch/msg/oauth/SB0nqMj94gH7JulPlXg5cUbs4jE>
Subject: Re: [OAUTH-WG] Feedback on OAuth for browser-based Apps
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: Thu, 25 Jul 2019 06:28:33 -0000

To clarify.

Using CSP is a general best practice for every JS app.

Once tokens are stored in the browser you want to specifically focus on
injection attacks (XSS) - disabling inline scripting is key to that.

———
Dominick

On 24. July 2019 at 23:04:20, Aaron Parecki (aaron@parecki.com) wrote:

On Mon, Jul 22, 2019 at 2:14 AM Dominick Baier
<dbaier@leastprivilege.com> wrote:

> I think you are mixing authentication and API access here. Depending on
application scenario it makes a lot of sense to use OIDC - but rely on the
resulting session to control API access.
> Unless you want to dive into the details here, I suggest you remove the
mention of OIDC because it is misleading.

I agree, I removed the mention of OIDC.

> I would rather say that ANY JS app should use CSP to lock down the
browser features to a minimal attack surface. In addition, if refresh or
access tokens are involved - further settings like disabling inline
scripting (unsafe inline) and eval should be disabled.

I'm not sure what to do with this suggestion. It feels like a blanket
recommendation of enabling CSP will likely be ignored since it's too
broad, and recommending disabling inline scripts is overreaching
unless backed up by a specific threat it's protecting against. Did you
have a particular threat in mind?

----
Aaron Parecki
aaronparecki.com
@aaronpk



On Mon, Jul 22, 2019 at 2:14 AM Dominick Baier
<dbaier@leastprivilege.com> wrote:
>
> Hey,
>
> Just read the spec - good to see the progress. Some feedback:
>
> I am yet undecided if I like the categorisation of the “Application
Architecture Patterns”. I definitely want to distinguish between
applications only accessing same-site back-end services and “others”. Not
sure if “dynamic application server" and “static application server” should
be handled differently - they are deployment details and should not decide
on the application security architecture. Also not sure how realistic it is
to deploy a typical applications solely from e.g. a CDN. But I don’t have
the right answer wrt to categories right now.
>
> 6.1. Apps Served from a Common Domain as the Resource Server
>
> > OAuth and OpenID Connect provide very little benefit in this
> deployment scenario, so it is recommended to reconsider whether you
> need OAuth or OpenID Connect at all in this case.
>
> I think you are mixing authentication and API access here. Depending on
application scenario it makes a lot of sense to use OIDC - but rely on the
resulting session to control API access.
> Unless you want to dive into the details here, I suggest you remove the
mention of OIDC because it is misleading.
>
>
> 6.2. Apps Served from a Dynamic Application Server
>
> I have a .NET sample for that
>
>
https://github.com/leastprivilege/AspNetCoreSecuritySamples/tree/aspnetcore21/BFF
> And a blog post
>
https://leastprivilege.com/2019/01/18/an-alternative-way-to-secure-spas-with-asp-net-core-openid-connect-oauth-2-0-and-proxykit/
>
> 9.7. Content-Security Policy
>
> A browser-based application that wishes to use either long-lived
> refresh tokens or privileged scopes SHOULD restrict its JavaScript
> execution to a set of statically hosted scripts via a Content
> Security Policy ([CSP2]) or similar mechanism.
>
>
>
> I would rather say that ANY JS app should use CSP to lock down the
browser features to a minimal attack surface. In addition, if refresh or
access tokens are involved - further settings like disabling inline
scripting (unsafe inline) and eval should be disabled.
>
> Thanks for doing this work!
>
> ———
> Dominick
> _______________________________________________
> OAuth mailing list
> OAuth@ietf.org
> https://www.ietf.org/mailman/listinfo/oauth