W3C home > Mailing lists > Public > public-webappsec@w3.org > February 2013

Re: CSP script hashes

From: Jacob Hoffman-Andrews <jsha@twitter.com>
Date: Tue, 12 Feb 2013 10:27:58 -0800
Message-ID: <CADzQPXvgxqfYr3UVgkbVWYhYC3QnpkTYPj0OHxTKrvvKk0nJCA@mail.gmail.com>
To: Yoav Weiss <yoav@yoav.ws>
Cc: Bryan McQuade <bmcquade@google.com>, Eric Chen <eric.chen@sv.cmu.edu>, Nicholas Green <ngreen@twitter.com>, "public-webappsec@w3.org" <public-webappsec@w3.org>
>  What about having a single inline-hash that is a digest of all allowed
>> inline content in the document, including both styles and scripts? The
>> browser would maintain a running digest as it encounters each style or
>> script tag. Once the digest matches the allowed inline-hash the browser
>> would execute the content immediately, or would report a violation upon
>> reaching the end of the document without ever matching the hash.
> That would mean the browser cannot start executing inline scripts & styles
> until the entire HTML has been downloaded (or at the very least, the last
> inlined resource). Even for static HTMLs with multiple inlined resources,
> this can result in a significant slowdown of the page load without any
> benefit. (saving 30 bytes on the response headers doesn't seem like a
> significant benefit)

That's why I said the browser should execute immediately once the digest
matches the inline-hash. I believe that all uses for which inline script is
important involve script at the top of the document. Also I believe that a
browser won't start executing any script in a given tag until it reaches
the end of the tag. So even if the chunk of JS that you include at the top
of your page is very large, it won't execute any later than it normally
Received on Tuesday, 12 February 2013 18:29:09 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:54:31 UTC