<?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>260284</bug_id>
          
          <creation_ts>2023-08-16 13:06:27 -0700</creation_ts>
          <short_desc>Incorrect Sec-Fetch-Site values on sandboxed iframes</short_desc>
          <delta_ts>2024-06-16 23:38:00 -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>Frames</component>
          <version>Safari 16</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=256472</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="Jerry Zhang">jerryzz</reporter>
          <assigned_to name="youenn fablet">youennf</assigned_to>
          <cc>achristensen</cc>
    
    <cc>annevk</cc>
    
    <cc>bfulgham</cc>
    
    <cc>cdumez</cc>
    
    <cc>jerryzz</cc>
    
    <cc>pgriffis</cc>
    
    <cc>vincentlee</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wilander</cc>
    
    <cc>youennf</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1971573</commentid>
    <comment_count>0</comment_count>
    <who name="Jerry Zhang">jerryzz</who>
    <bug_when>2023-08-16 13:06:27 -0700</bug_when>
    <thetext>The Sec-Fetch-Site header is supposed to reflect the relationship between the origin of request&apos;s initiator and the origin of it&apos;s target. (https://w3c.github.io/webappsec-fetch-metadata/#sec-fetch-site-header)

However, the current behavior seems to be incorrect for sandboxed iframes where a same-origin url will result in a Sec-Fetch-Site header with value &quot;cross-site&quot;. i.e. 

Reproduction steps:
Visit https://polar-purrfect-pangolin.glitch.me/sandboxediframe.html which contains:

&lt;iframe src=&quot;https://polar-purrfect-pangolin.glitch.me/&quot; sandbox&gt;&lt;/iframe&gt;

Expected behavior:
The Sec-Fetch-Site header of the sandboxed iframe request has value &quot;same-origin&quot;

Actual behavior:
The Sec-Fetch-Site header of the sandboxed iframe request has value &quot;cross-site&quot;

https://bugs.webkit.org/show_bug.cgi?id=256472 may be related.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1973068</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-08-23 13:07:16 -0700</bug_when>
    <thetext>&lt;rdar://problem/114340186&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2039079</commentid>
    <comment_count>2</comment_count>
    <who name="Vincent Lee">vincentlee</who>
    <bug_when>2024-05-31 10:20:24 -0700</bug_when>
    <thetext>Hi, what&apos;s the status on this? We&apos;d love to roll out serverside security checks for Safari based on the Sec-Fetch headers, but Sec-Fetch-Site not being correct is giving us pause. We&apos;ve rolled out on all other browsers, so only Safari is left.

This appears to still be a bug in Safari 17.5</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2039082</commentid>
    <comment_count>3</comment_count>
    <who name="Vincent Lee">vincentlee</who>
    <bug_when>2024-05-31 10:31:35 -0700</bug_when>
    <thetext>Actually, on further reading of the spec, I&apos;m Chrome and FF might be the ones with the bug here. 

Sandboxing an iframe without `allow-same-origin` means the origin becomes opaque, and if I&apos;m reading the language correctly for Sec-Fetch-Site, the algorithm for setting the header asserts that the request is from a &quot;potentially trustworthy origin&quot;, which an opaque origin is not.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2039375</commentid>
    <comment_count>4</comment_count>
    <who name="youenn fablet">youennf</who>
    <bug_when>2024-06-03 01:23:05 -0700</bug_when>
    <thetext>I think Chrome and FF are correct here. The env origin is the top level frame.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2039388</commentid>
    <comment_count>5</comment_count>
    <who name="youenn fablet">youennf</who>
    <bug_when>2024-06-03 02:31:11 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/29450</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2041627</commentid>
    <comment_count>6</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-06-16 23:37:57 -0700</bug_when>
    <thetext>Committed 280065@main (deeefb52b7fd): &lt;https://commits.webkit.org/280065@main&gt;

Reviewed commits have been landed. Closing PR #29450 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>