<?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>291194</bug_id>
          
          <creation_ts>2025-04-07 04:53:14 -0700</creation_ts>
          <short_desc>REGRESSION(289693@main): [SOUP] iframe on same apex as parent can&apos;t access cookies</short_desc>
          <delta_ts>2025-04-10 12:57:16 -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>WebKitGTK</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>DoNotImportToRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Simon Knott">info</reporter>
          <assigned_to name="Patrick Griffis">pgriffis</assigned_to>
          <cc>bugs-noreply</cc>
    
    <cc>dpino</cc>
    
    <cc>fujii</cc>
    
    <cc>jonathan</cc>
    
    <cc>max</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>pgriffis</cc>
    
    <cc>yurys</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2109383</commentid>
    <comment_count>0</comment_count>
    <who name="Simon Knott">info</who>
    <bug_when>2025-04-07 04:53:14 -0700</bug_when>
    <thetext>The child iframe can&apos;t access its parent cookies, even though it&apos;s on the same apex domain.

This bug was introduced in c6414d5c4ed2fed77d0f485a1ff0a8621411c562...3e847b33c9aa193c4a1fc72e530dd3edaf4f11a2.

# Repro

```js
require(&apos;http&apos;).createServer((req, res) =&gt; {
    res.setHeader(&apos;Content-Type&apos;, &apos;text/html&apos;);
    if (req.headers.host === &apos;example.test&apos;) {
        res.setHeader(&apos;Set-Cookie&apos;, &apos;testCookie=value; SameSite=Lax; Domain=example.test&apos;);
        res.end(`
            &lt;p id=&quot;result&quot;&gt;&lt;/p&gt;
            &lt;script&gt;document.getElementById(&apos;result&apos;).textContent = document.cookie || &apos;no cookies&apos;;&lt;/script&gt;
            &lt;iframe src=&quot;http://sub.example.test&quot;&gt;&lt;/iframe&gt;
        `);
    }
    else if (req.headers.host === &apos;sub.example.test&apos;) {
        res.end(`
            &lt;p id=&quot;result&quot;&gt;&lt;/p&gt;
            &lt;script&gt;document.getElementById(&apos;result&apos;).textContent = document.cookie || &apos;no cookies&apos;;&lt;/script&gt;
        `);
    } else {
        res.statusCode = 404;
        res.end();
    }
}).listen(80);
```

```
# add to /etc/hosts
127.0.0.1 example.test
127.0.0.1 sub.example.test
```

Open up `example.test`. I expect to see `testCookie=value` in both the parent and child frame. It actually shows `no cookies` in the child frame.

Originally reported as https://github.com/microsoft/playwright/issues/35439.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2109384</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Knott">info</who>
    <bug_when>2025-04-07 04:54:08 -0700</bug_when>
    <thetext>This occurs only on Linux. I&apos;m willing to work on a fix for this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2109659</commentid>
    <comment_count>2</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2025-04-08 00:02:30 -0700</bug_when>
    <thetext>libsoup is used on Linux. not libcurl.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2109947</commentid>
    <comment_count>3</comment_count>
    <who name="Max Schmitt">max</who>
    <bug_when>2025-04-09 08:21:02 -0700</bug_when>
    <thetext>Investigating: Looks like it only affects special domains like &apos;example.test&apos; or &apos;example.test1&apos;. Bisecting the change right now to see which patch caused it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2110147</commentid>
    <comment_count>4</comment_count>
    <who name="Max Schmitt">max</who>
    <bug_when>2025-04-10 03:49:05 -0700</bug_when>
    <thetext>- Bisected to https://github.com/webkit/webkit/commit/cb077473952d
- Might be this check https://gitlab.gnome.org/GNOME/libsoup/-/blob/master/libsoup/cookies/soup-cookie-jar.c#L539
- Which checks https://gitlab.gnome.org/GNOME/libsoup/-/blob/master/libsoup/soup-tld.c#L163</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2110181</commentid>
    <comment_count>5</comment_count>
    <who name="Patrick Griffis">pgriffis</who>
    <bug_when>2025-04-10 07:15:28 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/43899</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2110186</commentid>
    <comment_count>6</comment_count>
    <who name="Patrick Griffis">pgriffis</who>
    <bug_when>2025-04-10 07:26:20 -0700</bug_when>
    <thetext>So that patch fixes this specific case.

I do wonder though if WebKit is entirely correct to treat this as a third party domain. As you link libsoup already did too.

That said other browsers do not block the cookie in this situation.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2110187</commentid>
    <comment_count>7</comment_count>
    <who name="Patrick Griffis">pgriffis</who>
    <bug_when>2025-04-10 07:27:56 -0700</bug_when>
    <thetext>Actually WebKit on Apple platforms also do this, so I think its fine.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2110256</commentid>
    <comment_count>8</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-04-10 12:57:13 -0700</bug_when>
    <thetext>Committed 293538@main (3f1d5e3400d4): &lt;https://commits.webkit.org/293538@main&gt;

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

    </bug>

</bugzilla>