Open edhgoose opened 1 month ago
hey @edhgoose 👋
Thanks for your feedback. This is an intentional behavior for now. Those requests would be considered third party requests and many browsers have third party cookies protection, which would prevent them from attaching cookies in those requests.
I brought your topic to the team and we will discuss it further. Meanwhile keep an eye out in our dev docs! We will post anything new there.
Please list the package(s) involved in the issue, and include the version you are using
shopify/ui-extensions: ^2024.7
Describe the bug
When making a CORS request with all the right headers, Shopify UI Extensions will explicitly force cookies to be ommitted. This is via these lines from https://cdn.shopify.com/shopifycloud/checkout-web/assets/c1.en/sandbox.B93AeW43.worker.js:
The
credentials: "omit"
will force cookies to be removed from the fetch request as per MDN: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#including_credentialsSteps to reproduce the behavior:
access-control-allow-credentials: true
andaccess-control-allow-origin: https://extensions.shopifycdn.com
Expected behavior
I would expect either:
fetch
isn't overriden by Shopifyfetch
in the Security section https://shopify.dev/docs/api/checkout-ui-extensions#security, which leads to https://github.com/Shopify/ui-extensions/blob/unstable/documentation/runtime-environment.md would document that useCredentials is banned AND the same documentation would be available here too: https://shopify.dev/docs/api/checkout-ui-extensions/2024-10/configuration#network-access.I would prefer (1), as I can think of other cases where passing cookies might be useful - e.g. accessing an authenticated backend.
Screenshots
Additional context
The reason we would like the cookies to be passed is that we use cookies as one of several signals into anti fraud systems. While the cookies are not a perfect tool, they are a useful signal that can help us to spot customers attempting to manipulate us or our clients out of discounts.