<?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>276931</bug_id>
          
          <creation_ts>2024-07-22 23:15:38 -0700</creation_ts>
          <short_desc>Safari ignores style-src-elem in CSP</short_desc>
          <delta_ts>2026-01-31 10:51:45 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Page Loading</component>
          <version>Safari 18</version>
          <rep_platform>Mac (Intel)</rep_platform>
          <op_sys>macOS 14</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=203757</see_also>
    
    <see_also>https://github.com/web-platform-tests/wpt/pull/54080</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>BrowserCompat, InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Maxim Mazurok">maxim</reporter>
          <assigned_to name="Ryan Reno">rreno</assigned_to>
          <cc>beidson</cc>
    
    <cc>bfulgham</cc>
    
    <cc>fiyaas007</cc>
    
    <cc>karlcow</cc>
    
    <cc>rreno</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wilander</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2047701</commentid>
    <comment_count>0</comment_count>
    <who name="Maxim Mazurok">maxim</who>
    <bug_when>2024-07-22 23:15:38 -0700</bug_when>
    <thetext>In short, when using &lt;link&gt; and @import approach to add CSS to my website, Safari 17 (both on Mac and on iOS) doesn&apos;t let them load even though they are allowed in style-src-elem directive. Workaround is to put them into style-src directive, which is less restrictive than style-src-elem, so it isn&apos;t preferred.

See https://github.com/Maxim-Mazurok/csp-safari-issue for reproduction, and follow the steps from the README.md

Another reproduction I found here: https://csplite.com/csp/test235/#test (you&apos;ll need to login to see it, and 2a and 3 test will fail in Safari and pass in Chrome/Firefox).

Here&apos;s the full list of user-agents that experience the same issue on our production website:

Mozilla/5.0 (iPad; CPU OS 17_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/125.0.6422.80 Mobile/15E148 Safari/604.1
Mozilla/5.0 (iPad; CPU OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/125.0.6422.80 Mobile/15E148 Safari/604.1
Mozilla/5.0 (iPad; CPU OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1
Mozilla/5.0 (iPhone; CPU iPhone OS 15_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/126 Mobile/15E148 Version/15.0
Mozilla/5.0 (iPhone; CPU iPhone OS 17_1_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1.2 Mobile/15E148 Safari/604.1
Mozilla/5.0 (iPhone; CPU iPhone OS 17_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/125.0.6422.80 Mobile/15E148 Safari/604.1
Mozilla/5.0 (iPhone; CPU iPhone OS 17_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Mobile/15E148 Safari/604.1
Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/126.0.6478.153 Mobile/15E148 Safari/604.1
Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/126.0.6478.54 Mobile/15E148 Safari/604.1
Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) GSA/308.0.615969171 Mobile/15E148 Safari/604.1
Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) GSA/319.0.638705450 Mobile/15E148 Safari/604.1
Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) GSA/320.0.639621854 Mobile/15E148 Safari/604.1
Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 [FBAN/FBIOS;FBAV/462.0.0.35.110;FBBV/609503125;FBDV/iPhone16,2;FBMD/iPhone;FBSN/iOS;FBSV/17.5.1;FBSS/3;FBCR/;FBID/phone;FBLC/en_GB;FBOP/80]
Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 [FBAN/FBIOS;FBAV/463.0.0.32.110;FBBV/612837805;FBDV/iPhone16,2;FBMD/iPhone;FBSN/iOS;FBSV/17.5.1;FBSS/3;FBCR/;FBID/phone;FBLC/en_GB;FBOP/80]
Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.49(0x18003137) NetType/WIFI Language/zh_CN
Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.3 Safari/605.1.15
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Safari/605.1.15
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Safari/605.1.15 (Applebot/0.1; +http://www.apple.com/go/applebot)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Safari/605.1.15
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2049383</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-07-29 23:16:12 -0700</bug_when>
    <thetext>&lt;rdar://problem/132783992&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2053983</commentid>
    <comment_count>2</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2024-08-19 20:28:26 -0700</bug_when>
    <thetext>Maxim,

Thanks for the reports
Would you mind sharing the live site where this is happening?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2054308</commentid>
    <comment_count>3</comment_count>
    <who name="Maxim Mazurok">maxim</who>
    <bug_when>2024-08-20 18:45:42 -0700</bug_when>
    <thetext>Hi Karl,

Sure, here&apos;s a live website with a reproduction: https://csp-safari-issue.vercel.app/
It works in Chrome (funky font loaded), and it doesn&apos;t work in Safari (default font used).
It is a deployment of the &apos;static&apos; branch: https://github.com/Maxim-Mazurok/csp-safari-issue/tree/static

Hope this helps!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2115028</commentid>
    <comment_count>4</comment_count>
    <who name="Maxim Mazurok">maxim</who>
    <bug_when>2025-05-05 00:10:05 -0700</bug_when>
    <thetext>(In reply to Karl Dubost from comment #2)
&gt; Maxim,
&gt; 
&gt; Thanks for the reports
&gt; Would you mind sharing the live site where this is happening?

Hi Karl, it&apos;s been a while. I was wondering if you had a chance to check out the reproduction? It&apos;s still happening for me on Desktop Safari 18.3.1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2115053</commentid>
    <comment_count>5</comment_count>
    <who name="Maxim Mazurok">maxim</who>
    <bug_when>2025-05-05 04:32:55 -0700</bug_when>
    <thetext>Same on Safari Version 18.4 (19621.1.15.111.1, 19621) on macOS 14.7.5 (23H527)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2133310</commentid>
    <comment_count>6</comment_count>
    <who name="Ryan Reno">rreno</who>
    <bug_when>2025-07-29 22:06:57 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/48702</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2133315</commentid>
    <comment_count>7</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2025-07-29 22:31:32 -0700</bug_when>
    <thetext>@Maxim, Ryan found the source of the issue after investigating another public website where this is failing too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2133316</commentid>
    <comment_count>8</comment_count>
    <who name="Maxim Mazurok">maxim</who>
    <bug_when>2025-07-29 22:34:09 -0700</bug_when>
    <thetext>Awesome, thank you! I&apos;m not familiar with WebKit sources, but PR looks promising!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2133677</commentid>
    <comment_count>9</comment_count>
    <who name="Ryan Reno">rreno</who>
    <bug_when>2025-07-31 11:34:06 -0700</bug_when>
    <thetext>Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/54080</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2133729</commentid>
    <comment_count>10</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-07-31 15:04:20 -0700</bug_when>
    <thetext>Committed 298104@main (3b36e1e3244a): &lt;https://commits.webkit.org/298104@main&gt;

Reviewed commits have been landed. Closing PR #48702 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2176909</commentid>
    <comment_count>11</comment_count>
    <who name="">fiyaas007</who>
    <bug_when>2026-01-31 10:51:45 -0800</bug_when>
    <thetext>(In reply to Maxim Mazurok from comment #0)
&gt; In short, when using &lt;link&gt; and @import approach to add CSS to my website,
&gt; Safari 17 (both on Mac and on iOS) doesn&apos;t let them load even though they
&gt; are allowed in style-src-elem directive. Workaround is to put them into
&gt; style-src directive, which is less restrictive than style-src-elem, so it
&gt; isn&apos;t preferred.
&gt; 
&gt; See https://github.com/Maxim-Mazurok/csp-safari-issue for reproduction, and
&gt; follow the steps from the README.md
&gt; 
&gt; Another reproduction I found here: https://csplite.com/csp/test235/#test
&gt; (you&apos;ll need to login to see it, and 2a and 3 test will fail in Safari and
&gt; pass in Chrome/Firefox).
&gt; 
&gt; Here&apos;s the full list of user-agents that experience the same issue on our
&gt; production website:
&gt; 
&gt; Mozilla/5.0 (iPad; CPU OS 17_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML,
&gt; like Gecko) CriOS/125.0.6422.80 Mobile/15E148 Safari/604.1
&gt; Mozilla/5.0 (iPad; CPU OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML,
&gt; like Gecko) CriOS/125.0.6422.80 Mobile/15E148 Safari/604.1
&gt; Mozilla/5.0 (iPad; CPU OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML,
&gt; like Gecko) Version/17.5 Mobile/15E148 Safari/604.1
&gt; Mozilla/5.0 (iPhone; CPU iPhone OS 15_8 like Mac OS X) AppleWebKit/605.1.15
&gt; (KHTML, like Gecko) FxiOS/126 Mobile/15E148 Version/15.0
&gt; Mozilla/5.0 (iPhone; CPU iPhone OS 17_1_2 like Mac OS X)
&gt; AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1.2 Mobile/15E148
&gt; Safari/604.1
&gt; Mozilla/5.0 (iPhone; CPU iPhone OS 17_4 like Mac OS X) AppleWebKit/605.1.15
&gt; (KHTML, like Gecko) CriOS/125.0.6422.80 Mobile/15E148 Safari/604.1
&gt; Mozilla/5.0 (iPhone; CPU iPhone OS 17_4_1 like Mac OS X)
&gt; AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Mobile/15E148
&gt; Safari/604.1
&gt; Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15
&gt; (KHTML, like Gecko) CriOS/126.0.6478.153 Mobile/15E148 Safari/604.1
&gt; Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15
&gt; (KHTML, like Gecko) CriOS/126.0.6478.54 Mobile/15E148 Safari/604.1
&gt; Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15
&gt; (KHTML, like Gecko) GSA/308.0.615969171 Mobile/15E148 Safari/604.1
&gt; Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15
&gt; (KHTML, like Gecko) GSA/319.0.638705450 Mobile/15E148 Safari/604.1
&gt; Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15
&gt; (KHTML, like Gecko) GSA/320.0.639621854 Mobile/15E148 Safari/604.1
&gt; Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X)
&gt; AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148
&gt; [FBAN/FBIOS;FBAV/462.0.0.35.110;FBBV/609503125;FBDV/iPhone16,2;FBMD/iPhone;
&gt; FBSN/iOS;FBSV/17.5.1;FBSS/3;FBCR/;FBID/phone;FBLC/en_GB;FBOP/80]
&gt; Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X)
&gt; AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148
&gt; [FBAN/FBIOS;FBAV/463.0.0.32.110;FBBV/612837805;FBDV/iPhone16,2;FBMD/iPhone;
&gt; FBSN/iOS;FBSV/17.5.1;FBSS/3;FBCR/;FBID/phone;FBLC/en_GB;FBOP/80]
&gt; Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X)
&gt; AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148
&gt; MicroMessenger/8.0.49(0x18003137) NetType/WIFI Language/zh_CN
&gt; Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X)
&gt; AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148
&gt; Safari/604.1
&gt; Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML,
&gt; like Gecko) Version/16.3 Safari/605.1.15
&gt; Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML,
&gt; like Gecko) Version/16.6 Safari/605.1.15
&gt; Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML,
&gt; like Gecko) Version/17.0 Safari/605.1.15
&gt; Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML,
&gt; like Gecko) Version/17.4 Safari/605.1.15 (Applebot/0.1;
&gt; +http://www.apple.com/go/applebot)
&gt; Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML,
&gt; like Gecko) Version/17.4.1 Safari/605.1.15
&gt; Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML,
&gt; like Gecko) Version/17.5 Safari/605.1.15
&gt; Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like
&gt; Gecko) Chrome/125.0.0.0 Safari/537.36
&gt; Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like
&gt; Gecko) Chrome/126.0.0.0 Safari/537.36</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>