<?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>233640</bug_id>
          
          <creation_ts>2021-11-30 08:46:49 -0800</creation_ts>
          <short_desc>passthrough service workers should respect redirects when propagating navigation origin header</short_desc>
          <delta_ts>2021-12-01 00:48:18 -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>Service Workers</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <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="Ben Kelly">ben</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>achristensen</cc>
    
    <cc>cdumez</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>1818761</commentid>
    <comment_count>0</comment_count>
    <who name="Ben Kelly">ben</who>
    <bug_when>2021-11-30 08:46:49 -0800</bug_when>
    <thetext>Please see:

https://github.com/whatwg/fetch/pull/1345

Webkit already implements part of this spec change.  Specifically, it seems to propagate the requests origin for passthrough service workers that do `evt.respondWith(fetch(evt.request))`.

It does not, however, correctly set the origin header to `origin:null` if the FetchEvent.request is a navigation that redirected through a cross-origin URL.

The WPT tests for this change are at:

https://wpt.fyi/results/service-workers/service-worker/navigation-headers.https.html?label=experimental&amp;label=master&amp;aligned

Many of the failures there are for things not implemented by webkit yet and can be ignored.  The failures that matter for this bug are the test cases:

* &quot;POST Navigation, same-origin with same-site redirect and passthrough service worker sets correct origin and referer headers.&quot;
* &quot;POST Navigation, same-origin with cross-site redirect and passthrough service worker sets correct origin and referer headers.&quot;
* &quot;POST Navigation, same-origin with cross-site redirect, same-origin redirect, and passthrough service worker sets correct origin and referer headers.&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1818891</commentid>
    <comment_count>1</comment_count>
    <who name="Ben Kelly">ben</who>
    <bug_when>2021-11-30 12:54:08 -0800</bug_when>
    <thetext>Hmm, I didn&apos;t realize webkit implements some samesite cookies features as well.  It seems those are not taking the origin of the passthrough request into account currently.  See the failures in:

https://wpt.fyi/results/service-workers/service-worker/same-site-cookies.https.html?label=experimental&amp;label=master&amp;aligned

For example, the test case &quot;cross-site, window.open with passthrough&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1819144</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-12-01 00:48:18 -0800</bug_when>
    <thetext>&lt;rdar://problem/85911487&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>