<?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>201591</bug_id>
          
          <creation_ts>2019-09-08 12:01:19 -0700</creation_ts>
          <short_desc>CSP &quot;connect-src&quot; &apos;self&apos; does not match web socket scheme as per spec</short_desc>
          <delta_ts>2022-03-15 13:37:53 -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>DOM</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>235873</dup_id>
          
          <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="TJ">webkitbugs</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>achristensen</cc>
    
    <cc>beidson</cc>
    
    <cc>bfulgham</cc>
    
    <cc>cheshire137</cc>
    
    <cc>dbates</cc>
    
    <cc>han</cc>
    
    <cc>j+webkit-bugzilla</cc>
    
    <cc>katherine_cheney</cc>
    
    <cc>kris</cc>
    
    <cc>laurens.von.assel</cc>
    
    <cc>michael-rotarius</cc>
    
    <cc>m.kurz+webkitbugs</cc>
    
    <cc>moritz.mahringer</cc>
    
    <cc>otbotr</cc>
    
    <cc>pgriffis</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>w.janson</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1569017</commentid>
    <comment_count>0</comment_count>
    <who name="TJ">webkitbugs</who>
    <bug_when>2019-09-08 12:01:19 -0700</bug_when>
    <thetext>As per CSP spec paragraph 6.6.2.6, point 4. `self` match, 2nd match condition (https://w3c.github.io/webappsec-csp/#match-url-to-source-expression):

&gt; &quot;&apos;self&apos;&quot;, return &quot;Matches&quot; if one or more of the following conditions is met:
&gt; ...
&gt; 2. origin’s host is the same as url’s host, origin’s port and url’s port are either the same or the default ports for their respective schemes, and one or more of the following conditions is met:
&gt;   - url’s scheme is &quot;https&quot; or &quot;wss&quot;
&gt;   - origin’s scheme is &quot;http&quot; and url’s scheme is &quot;http&quot; or &quot;ws&quot;

This appears to not be working correctly in Safari, where I have a CSP of &quot;connect-src &apos;self&apos;&quot; for a service worker, but the service worker refuses to connect to a web socket on the same host and port, logging error

&gt; Refused to connect to wss://SOMEHOST/ws because it does not appear in the connect-src directive of the Content Security Policy.

Chromium had the same issue, fixed about a year ago: https://bugs.chromium.org/p/chromium/issues/detail?id=815142

Related W3C CSP Issue: https://github.com/w3c/webappsec-csp/issues/7</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1569581</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2019-09-10 10:29:17 -0700</bug_when>
    <thetext>&lt;rdar://problem/55227268&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1596749</commentid>
    <comment_count>2</comment_count>
    <who name="Moritz Mahringer">moritz.mahringer</who>
    <bug_when>2019-12-08 18:13:47 -0800</bug_when>
    <thetext>I encountered this bug today and verified that it exists in Safari but works as intended (by the specification) in Chrome and Firefox. Luckily we catched this with a report-only directive.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1728539</commentid>
    <comment_count>3</comment_count>
    <who name="Michael">michael-rotarius</who>
    <bug_when>2021-02-12 05:20:25 -0800</bug_when>
    <thetext>Still not fixed in Safari 14.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1851299</commentid>
    <comment_count>4</comment_count>
    <who name="">cheshire137</who>
    <bug_when>2022-03-15 08:18:02 -0700</bug_when>
    <thetext>Still present in Safari 15.3.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1851433</commentid>
    <comment_count>5</comment_count>
    <who name="Patrick Griffis">pgriffis</who>
    <bug_when>2022-03-15 12:31:55 -0700</bug_when>
    <thetext>bug 235873 probably does fix this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1851473</commentid>
    <comment_count>6</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2022-03-15 13:37:53 -0700</bug_when>
    <thetext>

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

    </bug>

</bugzilla>