<?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>149000</bug_id>
          
          <creation_ts>2015-09-09 07:10:24 -0700</creation_ts>
          <short_desc>Some extensions triggers CSP violation reports</short_desc>
          <delta_ts>2022-08-12 14:34:47 -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>New Bugs</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=144830</see_also>
    
    <see_also>https://bugs.chromium.org/p/chromium/issues/detail?id=233903</see_also>
    
    <see_also>https://bugzilla.mozilla.org/show_bug.cgi?id=866522</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Nicolas H.">dante3333</reporter>
          <assigned_to name="Timothy Hatcher">timothy</assigned_to>
          <cc>aljungberg</cc>
    
    <cc>andre</cc>
    
    <cc>ap</cc>
    
    <cc>bfulgham</cc>
    
    <cc>dak</cc>
    
    <cc>dante3333</cc>
    
    <cc>dbates</cc>
    
    <cc>jan</cc>
    
    <cc>jberlin</cc>
    
    <cc>opendarwin</cc>
    
    <cc>sam</cc>
    
    <cc>sam</cc>
    
    <cc>timothy</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>webkit</cc>
    
    <cc>webkit</cc>
    
    <cc>webkit</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1124613</commentid>
    <comment_count>0</comment_count>
    <who name="Nicolas H.">dante3333</who>
    <bug_when>2015-09-09 07:10:24 -0700</bug_when>
    <thetext>Steps to reproduce the problem:
1. Create a page with a CSP policy (without putting style-src &apos;unsafe-inline&apos;) and with a report uri
2. Open the page
3. Use some extensions like Diigo, Evernote, etc.
4. a report is sent to report-uri

What is the expected behavior?
The extension should not trigger any CSP policy violation, according to wikipedia : browsers and add-ins should be exempt from CSP =&gt; https://en.wikipedia.org/wiki/Content_Security_Policy#Browser_add-ons_and_extensions_exemption

What went wrong?
A report is sent to report-uri with safari-extension:// as source, like
 blocked-uri: &quot;safari-extension://com.evernote.safari.clipper-q79wdw8yh9&quot; 
(which shouldn&apos;t be)

The report_uri script gets a CSP violation. Example on one of my websites :

{
    &quot;csp-report&quot;: {
        &quot;document-uri&quot;: &quot;http://a11y.nicolas-hoffmann.net/tabs/&quot;,
        &quot;referrer&quot;: &quot;https://www.google.fr/&quot;,
        &quot;violated-directive&quot;: &quot;frame-src &apos;self&apos; &quot;,
        &quot;original-policy&quot;: &quot;default-src &apos;self&apos;;  script-src &apos;self&apos; *.jquery.com  ; style-src &apos;self&apos; &apos;unsafe-inline&apos; data:  ; img-src &apos;self&apos; data: ;  frame-src &apos;self&apos; ; report-uri /csp-parser.php&quot;,
        &quot;blocked-uri&quot;: &quot;safari-extension://com.wotservicesoy.wot-ff6ww26hl3&quot;
    }
}

I don&apos;t know if it may help, the same bug is present on Blink: https://code.google.com/p/chromium/issues/detail?id=524356 (with a lot of more details)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1289272</commentid>
    <comment_count>1</comment_count>
    <who name="silverwind">webkit</who>
    <bug_when>2017-03-18 05:59:33 -0700</bug_when>
    <thetext>Please make extension exempt from a Site&apos;s CSP, similar to how Chrome and Firefox already do. The issue also affects userscript engines like Tampermonkey:

https://github.com/Tampermonkey/tampermonkey/issues/296#issuecomment-222356524</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1289273</commentid>
    <comment_count>2</comment_count>
    <who name="silverwind">webkit</who>
    <bug_when>2017-03-18 07:08:05 -0700</bug_when>
    <thetext>It&apos;s also specced that CSP should not interfere with extensions: Cite from  https://w3c.github.io/webappsec-csp/#extensions:

&gt; Policy enforced on a resource SHOULD NOT interfere with the operation of user-agent features like addons, extensions, or bookmarklets</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1387604</commentid>
    <comment_count>3</comment_count>
    <who name="Sam Deane">sam</who>
    <bug_when>2018-01-10 04:07:30 -0800</bug_when>
    <thetext>It appears that the spec now says &quot;may&quot; and not &quot;should&quot;, so the current behaviour may not violate the letter of the law.

https://github.com/w3c/webappsec/commit/73963d509b20513a6f42b1e0839715aca8b578b0

It does however make it pretty hard (if not impossible) to implement a whole range of useful extensions which of necessity rely on script injection.

It seems sensible to have a mechanism that would allow browsers to exempt extensions (perhaps on a per-extension basis). It then comes down to a matter of user-trust whether to allow each extension full access - which seems to be in keeping with the W3C intent.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1455189</commentid>
    <comment_count>4</comment_count>
    <who name="Alexander Ljungberg">aljungberg</who>
    <bug_when>2018-08-30 03:11:47 -0700</bug_when>
    <thetext>I&apos;m also affected by this issue. I wrote a script to add some keyboard shortcuts to Phabricator and I inject it using Tampermonkey. Phabricator added a CSP header and it stops my extension from even loading.

In my opinion, the best solution would be to allow extensions to do what they want (that&apos;s the purpose of extensions after all).

The second best solution would be able to turn off CSP on a per site basis, say in Preferences.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1669748</commentid>
    <comment_count>5</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2020-07-08 07:56:11 -0700</bug_when>
    <thetext>&lt;rdar://problem/65223957&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>