<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>67008</bug_id>
          
          <creation_ts>2011-08-25 18:03:12 -0700</creation_ts>
          <short_desc>Content Security Policy in Chrome doesn&apos;t let whitelisted script run</short_desc>
          <delta_ts>2011-09-28 11:06:56 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>68921</dup_id>
          
          <bug_file_loc>http://gradgrind.erso.berkeley.edu/appendscripttest.php</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Adrienne Porter Felt">apf</reporter>
          <assigned_to name="Adam Barth">abarth</assigned_to>
          <cc>abarth</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>457311</commentid>
    <comment_count>0</comment_count>
    <who name="Adrienne Porter Felt">apf</who>
    <bug_when>2011-08-25 18:03:12 -0700</bug_when>
    <thetext>Load http:///gradgrind.erso.berkeley.edu/appendscripttest.php in Chrome and Firefox and you will get two different interpretations of the same CSP.

The site has the following CSP set:

    header(&quot;X-Content-Security-Policy: allow &apos;self&apos;; img-src *&quot;);
    header(&quot;X-WebKit-CSP: default-src &apos;self&apos;; img-src *&quot;);

On the page, a whitelisted script dynamically appends a &quot;script&quot; element to the head, with a source on the same domain.

    window.onload = function() {
        var headID = document.getElementsByTagName(&quot;head&quot;)[0];         
        var newScript = document.createElement(&apos;script&apos;);
        newScript.type = &apos;text/javascript&apos;;
        newScript.src = &apos;csp-4.js&apos;;
        headID.appendChild(newScript);
    }

In Firefox, the new script executes.
In Chrome, the new script does not execute even though the src is whitelisted.

It seems to me like the Firefox behavior is correct and the Chrome behavior is wrong.

(My tests done on Google Chrome 15.0.862.0 canary and Firefox 6.0.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>474853</commentid>
    <comment_count>1</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2011-09-28 11:06:56 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 68921 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>