WICG / shared-storage

Explainer for proposed web platform Shared Storage API
Other
88 stars 21 forks source link

Support event-level reporting for `selectURL()` in the short term #27

Closed pythagoraskitty closed 1 year ago

pythagoraskitty commented 2 years ago

For utility and adoptability, prior to the deprecation of third-party cookies, we will need to support event-level reporting for sharedStorage.selectURL() in a manner that is roughly equivalent to what the FLEDGE API has implemented in their registerAdBeacon().

We propose updating the urls parameter, which is currently an array of URLs, to an array of dictionaries where the metadata can be omitted, e.g. in the following example:

var opaqueURL = await window.sharedStorage.selectURL(
  "select-url-for-experiment",
  [{url: "blob:https://a.example/123…", report_event: "click", report_url: "https://report.example/1..."},
   {url: "blob:https://b.example/abc…", report_event: "click", report_url: "https://report.example/a..."},
   {url: "blob:https://c.example/789…"}],
  {data: {name: "experimentA"}});

We would then use this metadata to hook up to window.fence.reportEvent().

In the long term, however, we will not be able to support this type of reporting, as it can be used to leak the index simply by using a distinct report_url for each candidate Fenced Frame url.

We welcome feedback on this proposal.

xyaoinum commented 2 years ago

Should the worklet also handle dictionaries, or should it just expect the unpacked urls?

It feels more consistent to use the same parameter type. But on the other hand, the reporting data may not be useful inside the worklet.

pythagoraskitty commented 2 years ago

My current thinking is to just send the URLs to the worklet (unpacking in SharedStorageWorkletHost):

https://chromium-review.googlesource.com/c/chromium/src/+/3650846/7/content/browser/shared_storage/shared_storage_worklet_host.cc

As you said, the reporting data isn't useful inside the worklet, so it seemed strange to plumb it through there.