iOS Safari v13.4 amp-access-iframe ITP issue
What's the issue?
Safari introduced further changes to ITP (Intelligent Tracking Prevention) implementation, at this point fully blocking Third-Party cookies on iOS Safari starting with v13.4. https://webkit.org/blog/10218/full-third-party-cookie-blocking-and-more/
The issue introduces issues to these newer version of Safari when using the amp-access-iframe-api. The iframe is now unable to access storage from the primary site used to access things such as logged in/subscription status.
How do we reproduce the issue?
An example of this issue can be seen at https://jsbin.com/vehegosode/edit?html,js,output. This can be replicated on a iOS device w/ v13.4.x installed.
- Visit https://gremz.github.io/gremiasz-home/examples/set_cookie.html
- Click the
Set Cookiebutton (simulating a login) and confirmCurrent cookies: test_cookie=trueis shown - Visit https://output.jsbin.com/vehegosode and notice you get the text
paywall. Indicating the cookie was not able to be read.
The iframe checks to see if the cookie exists in the iframe, if it doesn't then the paywall is shown.
What browsers are affected?
iOS Safari v13.4 and above
Which AMP version is affected?
This a new issue, this implementation is working on older versions (< v13.4) of iOS Safari. Tested against AMP version 2004240001480.
Note that this is also reproducible on MacOS Safari starting from 13.1 (which makes it easier to debug). To get a realistic test on an actual AMP page, you must view the page on a google.com surface (or another site differing from the iframe's), e.g. url starting with https://www.google.com/amp/s/... so that the iframe is actually 3rd party.
It may not be possible to fix this directly. Safari forbids both reading & writing cookies in a 3rd party context. One potential savior is the Storage Access API but that requires user interaction to be triggered, and the user has to grant the access request.
The indirect workaround would be to somehow associate the READER_ID with whatever cookie value you intended to use.
This appears to have been fixed starting with iOS Safari v14. Closing.
I'm still able to reproduce this. iOS 14 now applies the same restrictions to browsers other than Safari.
See this Webkit report: https://bugs.webkit.org/show_bug.cgi?id=218396
On the google.com/amp surface, a couple things are relevant to ITP:
- the amp-access-iframe provided by the publisher is nested in an iframe 2-levels deep. All 3 levels have different origins. If it were only nested 1 level, there's a temporary workaround where interacting w/ the login popup gives storage access to the iframe.
- the intermediate iframe doesn't even have the same TLD as the amp-access-iframe, because google is using a CDN to "proxy" the publisher's article.
The only solutions I can see are:
- google changing the AMP framework so the publisher's origin is used for all 3 levels of frames (but that may not work if the access-iframe has the same TLD but is a different subdomain - the origin being different)
- using the readerID so the iframe can identify the user (this was the approach suggested by a Google developer)