<?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>279153</bug_id>
          
          <creation_ts>2024-09-04 16:04:45 -0700</creation_ts>
          <short_desc>iOS 18 does not allow a client application to specify SameSite=None</short_desc>
          <delta_ts>2025-01-14 09:35:46 -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>New Bugs</component>
          <version>Other</version>
          <rep_platform>iPhone / iPad</rep_platform>
          <op_sys>iOS 18</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Blocker</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>280080</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Kate Chon">chonkate</reporter>
          <assigned_to name="Charlie Wolfe">charliew</assigned_to>
          <cc>alexandcote</cc>
    
    <cc>charliew</cc>
    
    <cc>chonkate</cc>
    
    <cc>commit-queue</cc>
    
    <cc>gareth.shapiro</cc>
    
    <cc>josephasmith1310</cc>
    
    <cc>loydcrodrigueza</cc>
    
    <cc>max</cc>
    
    <cc>rikardt</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2057728</commentid>
    <comment_count>0</comment_count>
    <who name="Kate Chon">chonkate</who>
    <bug_when>2024-09-04 16:04:45 -0700</bug_when>
    <thetext>Context: Our organization distributes an in-house iOS application that injects an auth cookie into https://developer.apple.com/documentation/foundation/httpcookiestorage intended for our IdP (e.g. `auth.organization.com`), when the end-user navigates to (e.g. `service.alternate-domain.dev`), the service will redirect to the IdP and the expected cookie is not included in the request. This issue was first encountered with iOS 14 due to Intelligent Tracking Protection and we worked around the issue by enabling `NSCrossWebsiteTrackingUsageDescription` to allow our customers to opt-in to cross-domain cookies only within the application. Additionally, since iOS https://developer.apple.com/documentation/foundation/httpcookiestringpolicy has historically only allowed the &quot;Lax&quot; and &quot;Strict&quot; values, our application has been relying on the default behavior, when SameSite is omitted for WebKit to consider it to be `SameSite=None`. 

Issue and data:
On iOS 18 beta 8 we observed the same behavior of IdP cookie no longer being included in the request and observed the below behavior (with ITP disabled):
- WebKit is honoring the cookie&apos;s SameSite=None attribute when the cookie is set by server in this case the IdP
- Attempts to set this attribute from the client side (from the app interacting with the iOS cookie store) have been unsuccessful. For example, by setting `.sameSitePolicy = &quot;none&quot;`
- Safari Web Inspector shows the option to set the cookie&apos;s SameSite attribute to None, it however, does not get honored either, and is immediately reverted.

Analysis:
With the data collected so far it seems there is a gap between iOS default behavior to assume WebKit is using `SameSite=None` and the new WebKit change that breaks this assumption to now use `SameSite=Lax` as the default. Because of this gap, the iOS application is no longer able to set SameSite=None breaking existing web flows. 

Ask:
Our internal teams are evaluating multiple options for mitigating impact before iOS 18 release. As such we&apos;re looking to get a bit more data and opening up possible mitigation options:
- What is the purpose of introducing the backwards incompatible change for stricter cookie behavior (default SameSite=Lax) in WebKit?
- Why is the `SameSite=None` only honored when a server specifies the cookie attribute and not when the client specifies it?
- Is it feasible for WebKit to implement any of the below as a workaround
  - Add `none` as an expected cookie policy in https://developer.apple.com/documentation/foundation/httpcookiestringpolicy
  - Is there an alternate mechanism that would maintain the pre-existing cookie behavior for a specific application (e.g. through an Info.plist flag)
  - Can the `NSCrossWebsiteTrackingUsageDescription` be updated to maintain the pre-existing default cookie behavior when SameSite attribute is omitted, in addition to disabling ITP?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2057775</commentid>
    <comment_count>1</comment_count>
    <who name="Charlie Wolfe">charliew</who>
    <bug_when>2024-09-04 18:11:50 -0700</bug_when>
    <thetext>Thank you for reporting this. I have been able to reproduce the issue and am looking into it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2057776</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-09-04 18:12:13 -0700</bug_when>
    <thetext>&lt;rdar://problem/135312438&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2057777</commentid>
    <comment_count>3</comment_count>
    <who name="Kate Chon">chonkate</who>
    <bug_when>2024-09-04 18:16:26 -0700</bug_when>
    <thetext>Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2057796</commentid>
    <comment_count>4</comment_count>
    <who name="Charlie Wolfe">charliew</who>
    <bug_when>2024-09-04 20:25:28 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/33164</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2057799</commentid>
    <comment_count>5</comment_count>
    <who name="Kate Chon">chonkate</who>
    <bug_when>2024-09-04 20:43:04 -0700</bug_when>
    <thetext>!!!! THANK YOU SO MUCH!! 

Going through the commit, could you confirm the expectation is for app owners to add the new attribute with a string of &quot;none&quot; as shown below (swift)

```swift
let cookieProperties: [HTTPCookiePropertyKey: Any] = [
    .domain: &quot;auth.organization.com&quot;,
    .path: &quot;/&quot;,
    .name: &quot;sampleCookie&quot;,
    .value: &quot;sampleValue&quot;,
    .secure: &quot;TRUE&quot;,
    .sameSitePolicy: &quot;none&quot;,
]
```

If so, I can communicate this back to app owners so they can prepare an app build with the change.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2058016</commentid>
    <comment_count>6</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-09-05 13:31:17 -0700</bug_when>
    <thetext>Committed 283230@main (45ce92c14115): &lt;https://commits.webkit.org/283230@main&gt;

Reviewed commits have been landed. Closing PR #33164 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2058023</commentid>
    <comment_count>7</comment_count>
    <who name="Charlie Wolfe">charliew</who>
    <bug_when>2024-09-05 13:44:31 -0700</bug_when>
    <thetext>(In reply to Kate Chon from comment #5)
&gt; Going through the commit, could you confirm the expectation is for app
&gt; owners to add the new attribute with a string of &quot;none&quot; as shown below

Correct.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2058045</commentid>
    <comment_count>8</comment_count>
    <who name="Kate Chon">chonkate</who>
    <bug_when>2024-09-05 14:49:20 -0700</bug_when>
    <thetext>Thanks!!! 💜💜</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2058259</commentid>
    <comment_count>9</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-09-06 12:20:52 -0700</bug_when>
    <thetext>Committed 280938.311@safari-7619-branch (3b7cd3b4db5a): &lt;https://commits.webkit.org/280938.311@safari-7619-branch&gt;

Reviewed commits have been landed. Closing PR #1700 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2061906</commentid>
    <comment_count>10</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2024-09-20 12:20:02 -0700</bug_when>
    <thetext>Re-opened since this is blocked by bug 280080</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2062801</commentid>
    <comment_count>11</comment_count>
    <who name="Alexandre Côté">alexandcote</who>
    <bug_when>2024-09-24 12:24:15 -0700</bug_when>
    <thetext>When do we expect this fix to land?

If you open a Web console and try: 

```
document.cookie = &quot;foo=bar;Path=/;SameSite=None;Secure&quot;
```

Safari will not respect the `SameSite` attribute.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2062805</commentid>
    <comment_count>12</comment_count>
    <who name="Alexandre Côté">alexandcote</who>
    <bug_when>2024-09-24 12:33:16 -0700</bug_when>
    <thetext>Seems to be reverted here: https://github.com/WebKit/WebKit/commit/f30d4606699e8d9b5fbe2bb043c95bd8ff5fb9fa</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2062806</commentid>
    <comment_count>13</comment_count>
    <who name="Kate Chon">chonkate</who>
    <bug_when>2024-09-24 12:39:20 -0700</bug_when>
    <thetext>Hey Alexandre Côté our teams have been able to verify the issue is resolved on iOS 18.1 beta 5. Due to the re-opening of this ticket, it&apos;s unclear if we&apos;ll be able to expect this change to make it to general release.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2062997</commentid>
    <comment_count>15</comment_count>
    <who name="Gareth Shapiro">gareth.shapiro</who>
    <bug_when>2024-09-25 03:32:26 -0700</bug_when>
    <thetext>Hi.  Like others here I am very interested in what will be possible regarding SameSite attribute in iOS 18.1

We are seeing significant customer impact and currently it&apos;s quite difficult to provide assurance where I need to that a resolution is being planned for.

Comment #4 here :

https://bugs.webkit.org/show_bug.cgi?id=278353

makes reference to a scripting engine bug.

Ask:
It would be very useful to know whether it will be possible to successfully set `SameSite=None;Secure` from an iOS app running on 18.1 on webkit using the scripting engine once 18.1 goes into production.

Having this information up front would be particularly useful given the time it takes to assemble and get enterprise apps out the door.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2063699</commentid>
    <comment_count>16</comment_count>
    <who name="rikardt@greenerp.co.nz">rikardt</who>
    <bug_when>2024-09-27 03:02:00 -0700</bug_when>
    <thetext>Hi, We also having the same issue with the current 18.0 version across multiple clients, and it looks like it&apos;s resolved on 18.1 beta 5. Could we get confirmation on whether the current behavior will be the same as in the planned release version.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2065269</commentid>
    <comment_count>17</comment_count>
    <who name="Charlie Wolfe">charliew</who>
    <bug_when>2024-10-03 14:54:44 -0700</bug_when>
    <thetext>SameSite=None cookies by default have been restored in iOS 18.0.1. Please verify that your issues are resolved there.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2065302</commentid>
    <comment_count>18</comment_count>
    <who name="Kate Chon">chonkate</who>
    <bug_when>2024-10-03 16:21:17 -0700</bug_when>
    <thetext>Hello Charlie! Thank you so much on the update! Our teams have been able to verify impact has been mitigated. I hope you have a beautiful and lovely rest of your day!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>