-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should the domain of the shared storage script be restricted? #2
Comments
The decision is that the shared storage script's origin must match that of the context that created it. Due to concerns of poisoning and using up the origin's budget. Can revisit later if necessary. |
Would |
Thanks for bringing this back up Alex. I do think that header or a similar one to specify that this document is allowed to write to this origin's shared storage or run worklets on its behalf (perhaps separate controls) would provide for significant performance gains (e.g., not having to create an iframe just to write to shared storage). |
Hi Alex, Josh, I juse tested the next setup:
domain2.com/register_module.js script that registers module to shared storage worklet This gives an error that same origin expected. Both registration and module itself have configured CORS headers. So, looks like it is not allowed to host js module under different domain. Which means that it should be always same origin as ad server, which also means reporting origin will be the same as ad server origin. This is not very convinient for clients as ad serving infrastructure might be controlled by different teams/organisations/departments than reporting infrastructure. Devinding by domain would make sense here. Would you have any suggestions here? Thanks, |
Hi Anatolii, We appreciate the feedback. Currently, the shared storage worklet script has to be same-origin as the frame it's embedded in. So, you have to create an iframe to run this script on the different origin. However, as Josh said above, we are considering changing this requirement to avoid the performance issue of creating that iframe. Best, |
Hi Alex, thanks for answering. I probably misunderstood the way how it should be setup. I thought when Josh said "e.g., not having to create an iframe just to write to shared storage" it was about iframe on publisher side, but Josh was probably saying about iframe from ad-tech side in iframe from publisher (nested iframe)? Just want to share how I made it work, and probably get some feedback from you and Josh whether this makes sense. How ad is served now:
Initially I tried to add registration and run script to html part of the response from https://ad-exchange-server.com. I.e.:
this was failing because I tried to add js module from https://ads-reports-server.com origin while running it on https://ad-exchange-server.com origin. I also setup a header for ads-reports-server.com/module.js resource:
hoping that this will solve "same-origin" issue, but as I mentioned in my previous message it didn't. So when I read through the message from Josh again I added iframe to the response from https://ads-reports-server.com instead of the js code.
register_module.html is something like this:
Now when inner iframe has same origin as worklet module code - this is working and generates reports with desired reporting origin:
For us it is important that we separate reporting and ad serving infrastructure so this approach kind of solves our issues. Thanks, |
As noted in the references above, the explainer and spec have been updated with a new capability to create cross-origin worklets directly, without having to first create a x-origin iframe. The worklet script response headers script will need to opt into this with both CORS and a |
Can A.com load a shared storage worklet from a domain other than A.com? This seems to come down to how much you trust the entities on your page. E.g., if the top frame embeds untrusted script, that untrusted script might create worklets that report bogus aggregate data to poison the site's aggregate data.
Generally, the web does not protect documents from embedding scripts that could do terrible things. Should that same precedent apply here?
The text was updated successfully, but these errors were encountered: