Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Content Security Policy - final call for comments
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 38 - Collapse all  -  Translate all to Translated (View all originals)   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Brandon Sterne  
View profile  
 More options Apr 2, 5:12 pm
Newsgroups: mozilla.dev.security
From: Brandon Sterne <bste...@mozilla.com>
Date: Thu, 2 Apr 2009 14:12:42 -0700 (PDT)
Local: Thurs, Apr 2 2009 5:12 pm
Subject: Content Security Policy - final call for comments
Hello all,

We have been working hard lately to finish documenting the Content
Security Policy proposal, which we plan to start implementing very
soon.  For those of you who have followed the progression of CSP, you
have seen the model grow quite a bit in complexity.  As one thinks
through the CSP model, it becomes clear that a certain amount of
complexity is in fact necessary for the model to be useful.  I have
done my best to describe the model and provide justification for the
various restrictions here:
http://people.mozilla.org/~bsterne/content-security-policy/details.html

We now have a specification document to work from (thanks, Sid!) and
it and other supporting docs can be found on the Mozilla Wiki:
https://wiki.mozilla.org/Security/CSP/Spec

If you have feedback that you would like to share regarding Content
Security Policy, please do so ASAP as the window for making changes to
the model will soon be closing.

Cheers,
Brandon


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Florian Weimer  
View profile  
 More options Apr 4, 1:39 pm
Newsgroups: mozilla.dev.security
From: Florian Weimer <f...@deneb.enyo.de>
Date: Sat, 04 Apr 2009 19:39:54 +0200
Local: Sat, Apr 4 2009 1:39 pm
Subject: Re: Content Security Policy - final call for comments
* Brandon Sterne:

> We now have a specification document to work from (thanks, Sid!) and
> it and other supporting docs can be found on the Mozilla Wiki:
> https://wiki.mozilla.org/Security/CSP/Spec

The policy does not say explicitly what happens to javascript:
hyperlinks and the on* event handlers.

You shouldn't use an X- header because it's going to stick around and
preventing standardization (see X-Complaints-To on Usenet).


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brandon Sterne  
View profile  
 More options Apr 5, 1:38 pm
Newsgroups: mozilla.dev.security
From: Brandon Sterne <bste...@mozilla.com>
Date: Sun, 5 Apr 2009 10:38:14 -0700 (PDT)
Local: Sun, Apr 5 2009 1:38 pm
Subject: Re: Content Security Policy - final call for comments
On Apr 4, 10:39 am, Florian Weimer <f...@deneb.enyo.de> wrote:

> The policy does not say explicitly what happens to javascript:
> hyperlinks and the on* event handlers.

http://people.mozilla.org/~bsterne/content-security-policy/details.ht...

> You shouldn't use an X- header because it's going to stick around and
> preventing standardization (see X-Complaints-To on Usenet).

I think an X-header makes sense for CSP at this point, since it is not
yet standardized.  A standards group like W3C's public-webapps is
probably the right venue for that conversation to take place.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gervase Markham  
View profile  
 More options Apr 6, 6:56 am
Newsgroups: mozilla.dev.security
From: Gervase Markham <g...@mozilla.org>
Date: Mon, 06 Apr 2009 11:56:00 +0100
Subject: Re: Content Security Policy - final call for comments
Hi Brandon,

Thanks for your continued hard work on this.

Are we expecting to see some or all of this in Firefox 3.5, or Firefox-next?

On 02/04/09 22:12, Brandon Sterne wrote:

> If you have feedback that you would like to share regarding Content
> Security Policy, please do so ASAP as the window for making changes to
> the model will soon be closing.

Here are some comments on https://wiki.mozilla.org/Security/CSP/Spec. In
general, I think it's excellent :-)

- When might we see the "Refinements" section with the JS/eval changes?
Or is that the other document?

- "When both a X-Content-Security-Policy HTTP header and meta tag are
present, the intersection of the two policies is enforced; essentially,
the browser enforces the most *relaxed* policy satisfying both the
policies specified in the meta tag and header."

Surely you mean "strict", not "relaxed"? The example seems to show that
the resulting policy is more strict than either of the two source policies.

- What happens if a Report-URI encounters a redirect? We should say
specifically in the spec what we do, and I think we should honour it.
This would allow us to do "all reports must be sent to the same host
that served the protected content" while still allowing people to set it
up so that the logging server was a separate machine.

- Would it not be more flexible, with negligible change in
implementation complexity, to make report-uri multi-valued? We have to
support multiple values anyway.

- "but a declared (unexpanded) policy always has the "allow" directive."
I think you need to make it more clear that "allow" is mandatory. But
what was the logic behind making it so? Why not assume "allow *", which
is what browsers do in the absence of CSP anyway?

- The formal syntax uses "<host-expr-list>" but it's undefined in that
formal section. Is that intentional?

- Should there be a space or other separator in the middle of
"<allow-directive><directive-list>"?

- The Violation Report Sample has:
"<blocked-uri>some_image.png</blocked-uri>". Given that the directive
blocked was a "self" directive, I would expect some_image.png to be on
another host, and therefore for a full URI to be provided. (This is
vital for trying to find out who is behind the content injection.) What
have I missed?

And the other document
http://people.mozilla.org/~bsterne/content-security-policy/details.html:

- "policy-uri documents must be served with the MIME type
text/content-security-policy to be valid" This probably needs an "x-"
until we've registered it, which we should do before deployment. It's
not a complex process, I hear.

- "Hostname, including an optional leading wildcard, e.g. *.mozilla.org"
Does that include foo.bar.baz.mozilla.org? If so, we should say so
explicitly (in both docs).

Again, great work :-)

Gerv


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Johnathan Nightingale  
View profile  
 More options Apr 6, 12:17 pm
Newsgroups: mozilla.dev.security
From: Johnathan Nightingale <john...@mozilla.com>
Date: Mon, 6 Apr 2009 12:17:07 -0400
Local: Mon, Apr 6 2009 12:17 pm
Subject: Re: Content Security Policy - final call for comments

On 6-Apr-09, at 6:56 AM, Gervase Markham wrote:

> - "When both a X-Content-Security-Policy HTTP header and meta tag  
> are present, the intersection of the two policies is enforced;  
> essentially, the browser enforces the most *relaxed* policy  
> satisfying both the policies specified in the meta tag and header."

> Surely you mean "strict", not "relaxed"? The example seems to show  
> that the resulting policy is more strict than either of the two  
> source policies.

I think "relaxed" is the intent here, within the context of "the most  
relaxed policy *satisfying both* ... the meta tag and header."  So the  
intersection is more strict than either on its own, but no more strict  
than that intersection. I agree that the wording is a bit confusing.

Cheers,

J

---
Johnathan Nightingale
Human Shield
john...@mozilla.com


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sid Stamm  
View profile  
 More options Apr 6, 12:51 pm
Newsgroups: mozilla.dev.security
From: Sid Stamm <s...@mozilla.com>
Date: Mon, 06 Apr 2009 09:51:58 -0700
Local: Mon, Apr 6 2009 12:51 pm
Subject: Re: Content Security Policy - final call for comments
On 4/6/09 9:17 AM, Johnathan Nightingale wrote:

> I think "relaxed" is the intent here, within the context of "the most
> relaxed policy *satisfying both* ... the meta tag and header." So the
> intersection is more strict than either on its own, but no more strict
> than that intersection. I agree that the wording is a bit confusing.

Yeah, that's correct.  I must have been over-caffeinated when I wrote
that.  Here is the new, hopefully clearer text:

"essentially, the browser enforces a policy that is more strict than
both the policies specified in the meta tag and header, but only strict
enough to correspond to rules in both policies. Any web request that
satisfied both policies alone will be accepted by the new policy, but
any request rejected by either one or both of the two policies will be
rejected."

I also put a kind of formal description following it in the wiki.
https://wiki.mozilla.org/Security/CSP/Spec#Policy_Refinements_with_a_...

-Sid


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sid Stamm  
View profile  
 More options Apr 6, 1:12 pm
Newsgroups: mozilla.dev.security
From: Sid Stamm <s...@mozilla.com>
Date: Mon, 06 Apr 2009 10:12:49 -0700
Local: Mon, Apr 6 2009 1:12 pm
Subject: Re: Content Security Policy - final call for comments
On 4/6/09 3:56 AM, Gervase Markham wrote:
> - When might we see the "Refinements" section with the JS/eval changes?
> Or is that the other document?

The content is in the other document, but most likely we'll be moving
that to the wiki too (I've linked to the description doc in the mean time).

> - What happens if a Report-URI encounters a redirect? We should say
> specifically in the spec what we do, and I think we should honour it.
> This would allow us to do "all reports must be sent to the same host
> that served the protected content" while still allowing people to set it
> up so that the logging server was a separate machine.

Personally, I don't like the idea of honoring redirects for logging...
if a meta tag can be injected into a page (with a CSP header or not) and
the site hosts an open redirect, suddenly cookies can be stolen from all
visitors to a site.

> - Would it not be more flexible, with negligible change in
> implementation complexity, to make report-uri multi-valued? We have to
> support multiple values anyway.

While it's true that this would be easy to implement, I think we need to
set a limit.  We don't want to spawn off 100 requests every time a
policy is violated.  If that happens, attackers could leverage the
reporting mechanism in CSP to flood a network with traffic.  I'm not
convinced that widespread use will demand more than two report URIs, and
it's not difficult to set up that report URI recipient service to fork
copies to multiple other destinations.

> - "but a declared (unexpanded) policy always has the "allow" directive."
> I think you need to make it more clear that "allow" is mandatory. But
> what was the logic behind making it so? Why not assume "allow *", which
> is what browsers do in the absence of CSP anyway?

I think the intention for requiring the allow directive was to force the
policy-writer into writing out the default case to minimize possibility
for false assumptions.  I'm not sure though.

> - The formal syntax uses "<host-expr-list>" but it's undefined in that
> formal section. Is that intentional?

Nope... that's a mistake, should be "<source-list>".

> - Should there be a space or other separator in the middle of
> "<allow-directive><directive-list>"?

Indeed.  ";"

> - The Violation Report Sample has:
> "<blocked-uri>some_image.png</blocked-uri>". Given that the directive
> blocked was a "self" directive, I would expect some_image.png to be on
> another host, and therefore for a full URI to be provided. (This is
> vital for trying to find out who is behind the content injection.) What
> have I missed?

You're right, a full URI would be appropriate there.  The wiki was
actually parsing out the http://evil.com/ part from both references to
"some_image.png" and omitting it... weird.

Thanks for the comments!
-Sid


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brandon Sterne  
View profile  
 More options Apr 6, 7:52 pm
Newsgroups: mozilla.dev.security
From: Brandon Sterne <bste...@mozilla.com>
Date: Mon, 6 Apr 2009 16:52:28 -0700 (PDT)
Local: Mon, Apr 6 2009 7:52 pm
Subject: Re: Content Security Policy - final call for comments
Hi, Gerv.  Thanks a lot for your comments.  I'll address the comments
that weren't already covered by Johnathan or Sid, both of whom I agree
with.

On Apr 6, 3:56 am, Gervase Markham <g...@mozilla.org> wrote:

> Are we expecting to see some or all of this in Firefox 3.5, or Firefox-next?

Firefox-next.

> - "but a declared (unexpanded) policy always has the "allow" directive."
> I think you need to make it more clear that "allow" is mandatory. But
> what was the logic behind making it so? Why not assume "allow *", which
> is what browsers do in the absence of CSP anyway?

Sid did address this one, but I want to be clear in the rationale.
Once we see the Content Security Policy header (or meta tag), we want
to force sites to be explicit about what they are allowing.  Yes,
"allow *" is the default browser behavior without CSP presently, but
we want to avoid cases where sites assume the default behavior of CSP
is more restrictive than it actually is.  I could envision, for
example, a site presuming that "allow none" or "allow self" was the
default, and that additional policy could be specified from there.  If
a site really wants to "allow *", then we want them to explicitly
state that.

> And the other document
> http://people.mozilla.org/~bsterne/content-security-policy/details.html:

> - "policy-uri documents must be served with the MIME type
> text/content-security-policy to be valid" This probably needs an "x-"
> until we've registered it, which we should do before deployment. It's
> not a complex process, I hear.

That sounds fair.  I'll update the document with that change.

> - "Hostname, including an optional leading wildcard, e.g. *.mozilla.org"
> Does that include foo.bar.baz.mozilla.org? If so, we should say so
> explicitly (in both docs).

That's true too.  I'll make the language more clear.

Cheers,
Brandon


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel Veditz  
View profile  
 More options Apr 7, 2:36 am
Newsgroups: mozilla.dev.security
From: Daniel Veditz <dved...@mozilla.com>
Date: Mon, 06 Apr 2009 23:36:02 -0700
Local: Tues, Apr 7 2009 2:36 am
Subject: Re: Content Security Policy - final call for comments

Gervase Markham wrote:
> - "but a declared (unexpanded) policy always has the "allow" directive."
> I think you need to make it more clear that "allow" is mandatory. But
> what was the logic behind making it so? Why not assume "allow *", which
> is what browsers do in the absence of CSP anyway?

"allow" is not mandatory, but if missing it's assumed to be "allow
none". If you explicitly specify the whitelisted hosts for each type of
load you might not need or want a global fallback which could only be
used to sneak through types you hadn't thought about. Future browser
features, for instance.

Maybe this does point out the need for some kind of version number in
the header, so future browsers can take appropriate action when
encountering an old header. For example, assuming "none" for any newly
added types.

> - "policy-uri documents must be served with the MIME type
> text/content-security-policy to be valid" This probably needs an "x-"
> until we've registered it, which we should do before deployment. It's
> not a complex process, I hear.

Until we get CSP onto a standards track they'd probably want us to use a
text/vnd.mozilla.something, and since we'd like other browsers to
support this I vote we go for the "x-" for now.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Florian Weimer  
View profile  
 More options Apr 7, 3:52 am
Newsgroups: mozilla.dev.security
From: Florian Weimer <f...@deneb.enyo.de>
Date: Tue, 07 Apr 2009 09:52:25 +0200
Local: Tues, Apr 7 2009 3:52 am
Subject: Re: Content Security Policy - final call for comments
* Brandon Sterne:

> On Apr 4, 10:39 am, Florian Weimer <f...@deneb.enyo.de> wrote:
>> The policy does not say explicitly what happens to javascript:
>> hyperlinks and the on* event handlers.

> http://people.mozilla.org/~bsterne/content-security-policy/details.ht...

Uhm, I meant to say, it's not in the spec.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gervase Markham  
View profile  
 More options Apr 7, 7:01 am
Newsgroups: mozilla.dev.security
From: Gervase Markham <g...@mozilla.org>
Date: Tue, 07 Apr 2009 12:01:42 +0100
Local: Tues, Apr 7 2009 7:01 am
Subject: Re: Content Security Policy - final call for comments
On 06/04/09 18:12, Sid Stamm wrote:

> Personally, I don't like the idea of honoring redirects for logging...
> if a meta tag can be injected into a page (with a CSP header or not) and
> the site hosts an open redirect, suddenly cookies can be stolen from all
> visitors to a site.

Surely not? If Site Angelic redirects to Site Be-Evil, We don't send
Angelic's cookies to Be-Evil, do we? Or have I missed something? You may
need to describe the attack scenario in more detail for my small brain.

> While it's true that this would be easy to implement, I think we need to
> set a limit. We don't want to spawn off 100 requests every time a policy
> is violated. If that happens, attackers could leverage the reporting
> mechanism in CSP to flood a network with traffic.

But are there not easier ways of doing this - injecting <img> tags for
100 images on the target server, for example? Given that the reports are
so small, I can't see how anyone would want to use it as a DOS mechanism.

We should set a limit. I'm just wondering whether "2" is the most
convenient limit.

> I'm not convinced that
> widespread use will demand more than two report URIs, and it's not
> difficult to set up that report URI recipient service to fork copies to
> multiple other destinations.

True. It's not a big deal.

> I think the intention for requiring the allow directive was to force the
> policy-writer into writing out the default case to minimize possibility
> for false assumptions. I'm not sure though.

Fair enough. As long as the JS console/error report says something
sensible if it's missing.

Gerv


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gervase Markham  
View profile  
 More options Apr 7, 7:07 am
Newsgroups: mozilla.dev.security
From: Gervase Markham <g...@mozilla.org>
Date: Tue, 07 Apr 2009 12:07:39 +0100
Local: Tues, Apr 7 2009 7:07 am
Subject: Re: Content Security Policy - final call for comments
On 07/04/09 07:36, Daniel Veditz wrote:

> Maybe this does point out the need for some kind of version number in
> the header, so future browsers can take appropriate action when
> encountering an old header. For example, assuming "none" for any newly
> added types.

I much prefer forwardly-compatible designs to version numbers. I think
the current design is forwardly-compatible, as long as we maintain a
well-signposted public page listing which category all sorts of request
fall into, and add new request types well before they get implemented by
anyone.

For example, if a <3dvideo> tag, for which you needed red-blue glasses,
made it into a draft HTML5 spec, we would decide and say loudly that
this was included in "media-src" well before anyone actually implemented it.

Can you suggest a scenario in which version numbers would help?

Gerv


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gervase Markham  
View profile  
 More options Apr 7, 7:25 am
Newsgroups: mozilla.dev.security
From: Gervase Markham <g...@mozilla.org>
Date: Tue, 07 Apr 2009 12:25:26 +0100
Local: Tues, Apr 7 2009 7:25 am
Subject: Re: Content Security Policy - final call for comments
On 02/04/09 22:12, Brandon Sterne wrote:

> We have been working hard lately to finish documenting the Content
> Security Policy proposal,

What's the story on inline <style> and style=""? At the moment the
definition of "style-src" says they are subject to it, but there's no
valid value for "in this document", and in the script case, all inline
script is disabled.

Have we decided that there's a risk with all inline CSS style, or can we
define and enforce a large safe subset of the language? Making people
move their JS to external files is one thing, making them move all the
style as well is yet another.

Gerv


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sid Stamm  
View profile  
 More options Apr 7, 11:28 am
Newsgroups: mozilla.dev.security
From: Sid Stamm <s...@mozilla.com>
Date: Tue, 07 Apr 2009 08:28:03 -0700
Local: Tues, Apr 7 2009 11:28 am
Subject: Re: Content Security Policy - final call for comments
On 4/7/09 4:01 AM, Gervase Markham wrote:
> Surely not? If Site Angelic redirects to Site Be-Evil, We don't send
> Angelic's cookies to Be-Evil, do we? Or have I missed something? You may
> need to describe the attack scenario in more detail for my small brain.

Since the user's entire request header is in the report, any cookies
sent with the request header to Angelic get forwarded on.  While Be-Evil
doesn't actually get forwarded cookies, the cookies are buried in the
content of the report that is forwarded under the <request-headers> field.

>> I think the intention for requiring the allow directive was to force the
>> policy-writer into writing out the default case to minimize possibility
>> for false assumptions. I'm not sure though.

> Fair enough. As long as the JS console/error report says something
> sensible if it's missing.

Of course.   Any forgivable but bad policy syntax is going to be spat
into the error console.  Terminal ("can't parse") errors will cause CSP
to fail closed ("allow self") and still raise an error.

-Sid


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brandon Sterne  
View profile  
 More options Apr 7, 12:08 pm
Newsgroups: mozilla.dev.security
From: Brandon Sterne <bste...@mozilla.com>
Date: Tue, 07 Apr 2009 09:08:43 -0700
Local: Tues, Apr 7 2009 12:08 pm
Subject: Re: Content Security Policy - final call for comments
On 4/7/09 4:25 AM, Gervase Markham wrote:

> What's the story on inline <style> and style=""? At the moment the
> definition of "style-src" says they are subject to it, but there's no
> valid value for "in this document", and in the script case, all inline
> script is disabled.

As you mentioned, the style-src section indicates "...as well as inline
<style> elements and style attributes of HTML elements."  We are
basically treating CSS in the same manner as JavaScript.

> Have we decided that there's a risk with all inline CSS style, or can we
> define and enforce a large safe subset of the language? Making people
> move their JS to external files is one thing, making them move all the
> style as well is yet another.

Since style is a vector for JavaScript, via XBL, it needs to be subject
to the same restrictions.

-Brandon


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brandon Sterne  
View profile  
 More options Apr 7, 12:22 pm
Newsgroups: mozilla.dev.security
From: Brandon Sterne <bste...@mozilla.com>
Date: Tue, 07 Apr 2009 09:22:19 -0700
Local: Tues, Apr 7 2009 12:22 pm
Subject: Re: Content Security Policy - final call for comments
On 4/6/09 11:36 PM, Daniel Veditz wrote:

> "allow" is not mandatory, but if missing it's assumed to be "allow
> none". If you explicitly specify the whitelisted hosts for each type of
> load you might not need or want a global fallback which could only be
> used to sneak through types you hadn't thought about. Future browser
> features, for instance.

Not according to our proposed spec:
https://wiki.mozilla.org/Security/CSP/Spec#Directives
http://people.mozilla.org/~bsterne/content-security-policy/details.ht...

See comments from me and Sid from yesterday explaining why allow is
required.

I somewhat agree with the spirit of Dan's comment.  If allow is not
specified, then the _effect_ is to allow none, because the policy is
invalid and CSP will fail closed.  However, strictly speaking, we don't
assume allow none if it isn't specified.  We will treat that as invalid
policy, logging an error, and not loading any of the content types.

By falling back to "allow none" when invalid policy is sent, websites
will know right away that their pages are broken because no content,
other than textual elements will load.  This is a more secure option
than failing open and having websites potentially believe their users
are protected.

-Brandon


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bil Corry  
View profile  
 More options Apr 7, 12:42 pm
Newsgroups: mozilla.dev.security
From: Bil Corry <b...@corry.biz>
Date: Tue, 07 Apr 2009 11:42:57 -0500
Local: Tues, Apr 7 2009 12:42 pm
Subject: Re: Content Security Policy - final call for comments
Gervase Markham wrote on 4/7/2009 6:07 AM:

> On 07/04/09 07:36, Daniel Veditz wrote:
>> Maybe this does point out the need for some kind of version number in
>> the header, so future browsers can take appropriate action when
>> encountering an old header. For example, assuming "none" for any newly
>> added types.

> I much prefer forwardly-compatible designs to version numbers.

It has to work both ways; old CSP clients need to be able to parse new CSP rules that are unknown to them and new CSP clients need to be able to parse old CSP rules.  Where it will become a challenge is anytime something implicit has its meaning changed (e.g. the default is "x" in CSPv1 and "y" in CSPv2).

- Bil


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brandon Sterne  
View profile  
 More options Apr 7, 1:02 pm
Newsgroups: mozilla.dev.security
From: Brandon Sterne <bste...@mozilla.com>
Date: Tue, 07 Apr 2009 10:02:12 -0700
Local: Tues, Apr 7 2009 1:02 pm
Subject: Re: Content Security Policy - final call for comments
On 4/7/09 4:07 AM, Gervase Markham wrote:

> I much prefer forwardly-compatible designs to version numbers. I think
> the current design is forwardly-compatible, as long as we maintain a
> well-signposted public page listing which category all sorts of request
> fall into, and add new request types well before they get implemented by
> anyone.

> For example, if a <3dvideo> tag, for which you needed red-blue glasses,
> made it into a draft HTML5 spec, we would decide and say loudly that
> this was included in "media-src" well before anyone actually implemented
> it.

> Can you suggest a scenario in which version numbers would help?

I think the case for including a version number goes something like this
(and strong advocates, please chime in if I miss something):

1. Bugs may be present in the CSP design which require future
compatibility breakage.  These obviously cannot be foreseen and, though
we desire it, we can't guarantee forward compatibility.

2. New types of content (per your example) or new web APIs may be added
in the future which don't shoehorn nicely into one of our current policy
buckets.  If we have to add another policy directive in the future, then
it will violate the policy syntax in older versions which will cause
them to fail closed (according to the current design).

3. We arguably want to have a pref for users to turn off CSP (for
testing or otherwise).  It would be useful to have the version number
available as a means to communicate to the site that, even though the
client supports CSP by default, CSP has been disabled on this client.

I looked at each of the HTTP Header Field Definitions and my preference
for communicating the CSP version is to add a product token [1] to the
User-Agent [2] string.  This would add only a few bytes to the U-A and
it saves us the trouble of having to go through IETF processes of
creating a new request header.

Thoughts?

-Brandon

[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.8
[2] http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brandon Sterne  
View profile  
 More options Apr 7, 3:27 pm
Newsgroups: mozilla.dev.security
From: Brandon Sterne <bste...@mozilla.com>
Date: Tue, 07 Apr 2009 12:27:16 -0700
Local: Tues, Apr 7 2009 3:27 pm
Subject: Re: Content Security Policy - final call for comments
On 4/7/09 9:08 AM, Brandon Sterne wrote:

>> Have we decided that there's a risk with all inline CSS style, or can we
>> define and enforce a large safe subset of the language? Making people
>> move their JS to external files is one thing, making them move all the
>> style as well is yet another.

> Since style is a vector for JavaScript, via XBL, it needs to be subject
> to the same restrictions.

Actually, my reasoning is wrong here.

Style is no longer a vector for script under CSP because we added the
restriction that "XBL bindings must come from chrome: or resource: URIs"
for precisely this reason.

The other reason to make inline CSS subject to the style-src directive
(which I didn't state before because it didn't seem as strong a point)
is increased consistency in the model.  It seems inconsistent to offer
controls on where style can come from if the restriction can be bypassed
by injecting CSS directly into the document.  Granted, injected CSS
poses a much, much lower risk than injected script, but there is still
the issue of page defacement, etc.

I don't think the no-inline-style requirement is too punitive, though,
as sites can still use normal CSS selectors and apply their styles from
external, white-listed stylesheets.

Sorry for the confusion.

-Brandon


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bil Corry  
View profile  
 More options Apr 7, 4:40 pm
Newsgroups: mozilla.dev.security
From: Bil Corry <b...@corry.biz>
Date: Tue, 07 Apr 2009 15:40:14 -0500
Local: Tues, Apr 7 2009 4:40 pm
Subject: Re: Content Security Policy - final call for comments
Brandon Sterne wrote on 4/7/2009 12:02 PM:

> I looked at each of the HTTP Header Field Definitions and my preference
> for communicating the CSP version is to add a product token [1] to the
> User-Agent [2] string.  This would add only a few bytes to the U-A and
> it saves us the trouble of having to go through IETF processes of
> creating a new request header.

I agree that creating a request header for just the CSP version is overkill.  However, I am concerned that privacy add-ons, proxies, firewalls, etc may strip or replace the User-Agent string.

I propose a new request header is created, but instead of one that is specific to CSP, it is something more generic that can be used in the future by similar policy frameworks.

For example:

        Accept-Header: X-Content-Security-Policy version=2 securityLevel=2; X-Application-Boundaries-Enforcer type=browser

FWIW, "X-Application-Boundaries-Enforcer" refers to ABE: http://hackademix.net/2008/12/20/introducing-abe/

I originally came up with Accept-Header during a conversation about revising the Cookie specification; it would alert the server that the client understood "version 3" of cookies:

        Accept-Header: Set-Cookie version=3

So it does have a variety of uses that may make it worth the effort to register and define.

- Bil


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gervase Markham  
View profile  
 More options Apr 8, 2:57 pm
Newsgroups: mozilla.dev.security
From: Gervase Markham <g...@mozilla.org>
Date: Wed, 08 Apr 2009 19:57:40 +0100
Local: Wed, Apr 8 2009 2:57 pm
Subject: Re: Content Security Policy - final call for comments
On 07/04/09 16:28, Sid Stamm wrote:

> Since the user's entire request header is in the report, any cookies
> sent with the request header to Angelic get forwarded on. While Be-Evil
> doesn't actually get forwarded cookies, the cookies are buried in the
> content of the report that is forwarded under the <request-headers> field.

OK. Then we need to spec that redirects are not honoured.

Gerv


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gervase Markham  
View profile  
 More options Apr 8, 2:58 pm
Newsgroups: mozilla.dev.security
From: Gervase Markham <g...@mozilla.org>
Date: Wed, 08 Apr 2009 19:58:44 +0100
Local: Wed, Apr 8 2009 2:58 pm
Subject: Re: Content Security Policy - final call for comments
On 07/04/09 16:28, Sid Stamm wrote:

> Since the user's entire request header is in the report, any cookies
> sent with the request header to Angelic get forwarded on. While Be-Evil
> doesn't actually get forwarded cookies, the cookies are buried in the
> content of the report that is forwarded under the <request-headers> field.

... (following on from previous message) or we need to say that sites
with open redirects are already broken, and this is just another
symptom, and we should support redirects for the convenience and reduced
implementation complexity.

Gerv


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gervase Markham  
View profile  
 More options Apr 8, 3:07 pm
Newsgroups: mozilla.dev.security
From: Gervase Markham <g...@mozilla.org>
Date: Wed, 08 Apr 2009 20:07:40 +0100
Local: Wed, Apr 8 2009 3:07 pm
Subject: Re: Content Security Policy - final call for comments
On 07/04/09 18:02, Brandon Sterne wrote:

> 1. Bugs may be present in the CSP design which require future
> compatibility breakage.  These obviously cannot be foreseen and, though
> we desire it, we can't guarantee forward compatibility.

There are two sorts of possible breakage - syntax and functional. I
can't see us needing to throw away the syntax and, if we did, we'd just
define a new header. So no issues there. And functional breakage comes
into your second category anyway.

> 2. New types of content (per your example) or new web APIs may be added
> in the future which don't shoehorn nicely into one of our current policy
> buckets.  If we have to add another policy directive in the future, then
> it will violate the policy syntax in older versions which will cause
> them to fail closed (according to the current design).

But the old browsers also won't support the new APIs/whatever. If we add
a <3dcanvas> element to Firefox and control it with 3dcanvas-src, then
old browsers won't understand the element, and so ignore it. And so if
the browser didn't understand 3dcanvas-src either, that's no big deal.

CSP should specify that unknown directives are ignored. That's a fairly
common way to deal with this problem (CSS, HTML etc.).

The only problem would be if an existing browser feature acquires
specific restrictions when it used to be covered by "all". In that case,
users of old browsers would get less protection - but they had that
anyway, because their CSP implementation doesn't support the extra
restriction.

> 3. We arguably want to have a pref for users to turn off CSP (for
> testing or otherwise).  It would be useful to have the version number
> available as a means to communicate to the site that, even though the
> client supports CSP by default, CSP has been disabled on this client.

Why is that useful information?

I'm actually against making it easy for servers to "detect" if CSP is
supported, because if we make it particularly easy, content authors will
start relying on it as their only defence rather than using it as a
backup. "We don't need to check for XSS holes, we use CSP." That would
be bad. Of course, we can't stop them putting together fragile
User-Agent lists, but sites which do that are broken anyway, as the web
design community has been saying for years.

> I looked at each of the HTTP Header Field Definitions and my preference
> for communicating the CSP version is to add a product token [1] to the
> User-Agent [2] string.  This would add only a few bytes to the U-A and
> it saves us the trouble of having to go through IETF processes of
> creating a new request header.

I'd much rather have a "\d+;" at the start of the header. Missing
implies version 1.

Gerv


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bil Corry  
View profile  
 More options Apr 8, 3:45 pm
Newsgroups: mozilla.dev.security
From: Bil Corry <b...@corry.biz>
Date: Wed, 08 Apr 2009 14:45:23 -0500
Local: Wed, Apr 8 2009 3:45 pm
Subject: Re: Content Security Policy - final call for comments
Gervase Markham wrote on 4/8/2009 2:07 PM:

> On 07/04/09 18:02, Brandon Sterne wrote:
> I'm actually against making it easy for servers to "detect" if CSP is
> supported, because if we make it particularly easy, content authors will
> start relying on it as their only defence rather than using it as a
> backup. "We don't need to check for XSS holes, we use CSP." That would
> be bad. Of course, we can't stop them putting together fragile
> User-Agent lists, but sites which do that are broken anyway, as the web
> design community has been saying for years.

It seems unlikely that responsible web developers would rely entirely on CSP, especially initially, since not all UAs will support it.  And if the developer really does choose to rely entirely on CSP, there isn't much we can do -- any developer with two domains can easily test if the client supports CSP, request header or no header.

I think the stronger likelihood is that the developer won't use CSP at all -- their site will still work regardless.  Providing a CSP header that can be measured to show it's worth the effort to learn and implement will be a much stronger incentive.

In summary, given the number of XSS holes out there, if the developer chooses to rely entirely on CSP to protect them, that's far better than not using CSP at all.  The biggest threat to CSP is not over-reliance, but rather under-utilization.

- Bil


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brandon Sterne  
View profile  
 More options Apr 8, 4:49 pm
Newsgroups: mozilla.dev.security
From: Brandon Sterne <bste...@mozilla.com>
Date: Wed, 08 Apr 2009 13:49:17 -0700
Local: Wed, Apr 8 2009 4:49 pm
Subject: Re: Content Security Policy - final call for comments
On 4/8/09 12:07 PM, Gervase Markham wrote:

> On 07/04/09 18:02, Brandon Sterne wrote:
>> 1. Bugs may be present in the CSP design which require future
>> compatibility breakage.  These obviously cannot be foreseen and, though
>> we desire it, we can't guarantee forward compatibility.

> There are two sorts of possible breakage - syntax and functional. I
> can't see us needing to throw away the syntax and, if we did, we'd just
> define a new header. So no issues there. And functional breakage comes
> into your second category anyway.

Defining a new header seems like a non-starter to me.  We are going to
be hard-pressed to get one new header standardized, so throwing one away
seems very wasteful.

>> 3. We arguably want to have a pref for users to turn off CSP (for
>> testing or otherwise).  It would be useful to have the version number
>> available as a means to communicate to the site that, even though the
>> client supports CSP by default, CSP has been disabled on this client.

> Why is that useful information?

If sites are relying on CSP for XSS protection, then perhaps they would
want to serve only "trusted content" to non-CSP users.

> I'm actually against making it easy for servers to "detect" if CSP is
> supported, because if we make it particularly easy, content authors will
> start relying on it as their only defence rather than using it as a
> backup. "We don't need to check for XSS holes, we use CSP." That would
> be bad. Of course, we can't stop them putting together fragile
> User-Agent lists, but sites which do that are broken anyway, as the web
> design community has been saying for years.

In reality, as CSP becomes more mature and well-understood, sites will
rely on it for XSS mitigation.  It's inevitable that if we put a
reliable product out there sites will rely upon it.  CSP won't cause
input sanitization, etc. to be removed from Security Best Practices, but
it will be a standard part of the browser security model, I imagine.

>> I looked at each of the HTTP Header Field Definitions and my preference
>> for communicating the CSP version is to add a product token [1] to the
>> User-Agent [2] string.  This would add only a few bytes to the U-A and
>> it saves us the trouble of having to go through IETF processes of
>> creating a new request header.

> I'd much rather have a "\d+;" at the start of the header. Missing
> implies version 1.

But our header is only sent as a response header, so would not be useful
for sending version info with client requests.  We're somewhat averse to
adding a request header that would only carry the version info, so
that's why we're looking for an existing request header that can carry
this info.

-Brandon


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 1 - 25 of 38   Newer >
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google