Re: [websec] Coordinating Frame-Options and CSP UI Safety directives

Adam Barth <ietf@adambarth.com> Sun, 02 September 2012 15:41 UTC

Return-Path: <ietf@adambarth.com>
X-Original-To: websec@ietfa.amsl.com
Delivered-To: websec@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id DA39F21F84A2 for <websec@ietfa.amsl.com>; Sun, 2 Sep 2012 08:41:19 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.977
X-Spam-Level:
X-Spam-Status: No, score=-2.977 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vBkimAQrAwQQ for <websec@ietfa.amsl.com>; Sun, 2 Sep 2012 08:41:19 -0700 (PDT)
Received: from mail-ey0-f172.google.com (mail-ey0-f172.google.com [209.85.215.172]) by ietfa.amsl.com (Postfix) with ESMTP id B675B21F8452 for <websec@ietf.org>; Sun, 2 Sep 2012 08:41:18 -0700 (PDT)
Received: by eaai11 with SMTP id i11so1316832eaa.31 for <websec@ietf.org>; Sun, 02 Sep 2012 08:41:17 -0700 (PDT)
Received: by 10.14.203.70 with SMTP id e46mr18126046eeo.2.1346600477846; Sun, 02 Sep 2012 08:41:17 -0700 (PDT)
Received: from mail-ee0-f44.google.com (mail-ee0-f44.google.com [74.125.83.44]) by mx.google.com with ESMTPS id r45sm28981950eem.6.2012.09.02.08.41.14 (version=SSLv3 cipher=OTHER); Sun, 02 Sep 2012 08:41:15 -0700 (PDT)
Received: by eekb45 with SMTP id b45so1684559eek.31 for <websec@ietf.org>; Sun, 02 Sep 2012 08:41:14 -0700 (PDT)
Received: by 10.14.182.134 with SMTP id o6mr17766447eem.26.1346600474436; Sun, 02 Sep 2012 08:41:14 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.14.128.73 with HTTP; Sun, 2 Sep 2012 08:40:44 -0700 (PDT)
In-Reply-To: <504345AC.5050800@gondrom.org>
References: <370C9BEB4DD6154FA963E2F79ADC6F2E1799AD@DEN-EXDDA-S12.corp.ebay.com> <4FFB67EE.406@gondrom.org> <370C9BEB4DD6154FA963E2F79ADC6F2E17AE18@DEN-EXDDA-S12.corp.ebay.com> <68291699F5EA8848B0EAC2E78480571F053A3186@TK5EX14MBXC216.redmond.corp.microsoft.com> <CAJE5ia90hJ7EQDgn7Y3u2m1Lxe=fwkG65YE7YtiBNJfDtaE0rA@mail.gmail.com> <9B5348748B708948989B17CC0AEA3DD0027A848A@SN2PRD0310MB395.namprd03.prod.outlook.com> <043AA6DA-9D3F-4EC2-B5D4-E1FF2FD0F470@w3.org> <504345AC.5050800@gondrom.org>
From: Adam Barth <ietf@adambarth.com>
Date: Sun, 2 Sep 2012 08:40:44 -0700
Message-ID: <CAJE5ia_xpki2+WHD9KCmNJCW_WrrRHCRuff5eSxcTnLpWOtSGg@mail.gmail.com>
To: Tobias Gondrom <tobias.gondrom@gondrom.org>
Content-Type: text/plain; charset=ISO-8859-1
Cc: websec@ietf.org
Subject: Re: [websec] Coordinating Frame-Options and CSP UI Safety directives
X-BeenThere: websec@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Web Application Security Minus Authentication and Transport <websec.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/websec>, <mailto:websec-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/websec>
List-Post: <mailto:websec@ietf.org>
List-Help: <mailto:websec-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/websec>, <mailto:websec-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sun, 02 Sep 2012 15:41:20 -0000

On Sun, Sep 2, 2012 at 4:40 AM, Tobias Gondrom
<tobias.gondrom@gondrom.org> wrote:
> Hello all,
>
> thank you for your feedback and input.
>
> <hat="individual">
>
> NIH (not invented here) should definitely never be reason for a decision -
> in either way.
> And I would also be open to assist the WebAppSec WG in writing this tiny bit
> into CSP.
>
> I have two main reasons why I think we should keep FO separate to CSP and
> would like to hear your thoughts about it before we should make a decision.
> (Please note that in the case of this topic I will obviously not be acting
> as WG chair.)
>
> 1. Model and Semantic Reason:
> Until now, I always understood the CSP model to be about "describe the
> security policy for a loaded resource and say which parts of that content
> you can execute and which references in that content you shall follow and
> execute".
> While the XFO/FO model is the reverse: describing for a resource, defining
> by whom your resource may be framed/loaded from. In my view that was not a
> natural part of the CSP model. And in my understanding that semantic
> difference was also one of the reasons why it was not done in CSP1.0 in the
> first place, but at the time agreed to be done in websec separately.

Now that we're done with CSP 1.0, I think it make sense to take a more
expansive view of the sorts of security policies that can be expressed
in a Content-Security-Policy.  My view is that a security policy
expressed in CSP ought to have the following properties:

1) The policy should apply only to an individual resource
representation.  That means that the security policy is scoped to the
individual HTTP response and doesn't have broader-reaching effects
(e.g., about future HTTP responses).

2) The policy should only restrict privileges---not grant any
privileges.  That means that the security policy is useful for
implementing "least privilege": you can use it to drop privileges
you're not using (e.g., the ability to execute inline script) so that
an attacker can't trick you into using this privileges to your
detriment.

X-Frame-Options / Frame-Options fits nicely into this rubric.

> Or as someone else from W3C WebAppSec wrote it more clearly to me about a
> year ago:
> "... removing frame-ancestors from CSP altogether if a better, standardized
> Frame-Options is available to sites. In fact, it simplifies the model in
> some ways since frame-ancestors is currently the only directive that
> restricts content from the embedded site's perspective."

Having a simplified model has been very helpful to us over the past
year because it has let us finish CSP 1.0.  Now we're done with CSP
1.0 and looking at what the next step should be in CSP's evolution.

> 2. Technical Implementation:
> The current FO spec allows only one "Allow-From" URI. Which means that for
> complex framing relationships, the FO header needs to be written/sent on the
> fly on a per request basis.
> My question is, what happens to only one "ALLOW-FROM" if we integrate it
> into CSP?
> Can we generate individual CSPs on the fly as well (including if a CSP
> header references a file), or would this then implicitely mean we have to
> allow a list of "ALLOW-FROM"?

Integrating with CSP imposes no technical restrictions in this regard.
 If you want to have only a single source, you can define the syntax
as:

directive-name = "frame-options"
directive-value = source-expression

Most other directives use source-list (which is just a list of
source-expressions), but there's no reason we can't do something
different here if that makes sense.  In fact, the only hard technical
restriction on the directive-value is that it conform to the following
ABNF:

directive-value   = *( WSP / <VCHAR except ";" and ","> )

> (please note, that the initial version did allow a list for "Allow-From",
> but there were serious concerns for performance in implementation for large
> lists and privacy matters. The change to only one "Allow-From" is not
> "written in stone", still I would like to understand if we limit ourselves
> back to the "Allow-From list" implicitly by putting it into CSP? I had a
> couple of private conversations on this problem in the last months, but they
> could not definitively answer to that question...)

I'm a bit surprised that you'd want to limit frame-options to having
only one source-expression, but we can discuss that point regardless
of whether we decide to integrate it with CSP.

Adam