Closed sefeng211 closed 3 days ago
This is also connected to #62.
We've discussed this with the security folks.
As for as LCP/element-timing goes, the current restriction with Timing-Allow-Origin
doesn't make sense because that's a resource-based protection and render time is for the whole document.
So the current proposal is to remove the TAO restrictions, and instead coarsen the render time by 4ms (and clamp to the load time) when the document is not cross-origin-isolated. This would make trying to use timing attacks to figure out information about cross-origin images based on their decoding time not useful.
A more detailed explanation about this for the WG call:
renderTime
value is really the paint time of the frame after two conditions are fulfilled: (1) the image is loaded & decoded, (2) the image is added to the DOM.Timing-Allow-Origin
on the image if it's cross-origin. Images failing the TAO
test would receive a renderTime
of zero.Timing-Allow-Origin
. Cross-origin isolation protects any cross-origin resource on the page from indirect leaks, rather than a particular resource.renderTime
- but over-coarsened (to 4ms
resolution). This would allow enough information for performance analysis, while being coarse enough so that it does not expose decoding information in a meaningful way.
I haven't get a chance to do a proper testing for this, so I'll just refer to Michal's slide for TPAC 2022. Based on the slides, Firefox and Safari doesn't wait for the image to be decoded for FCP, but Chrome does.
Should we update the spec for FCP to wait for the image to be decoded?
I think the spec for LCP only waits for the size of the image to be known, it also doesn't wait for the image to be decoded. Should it also be updated as well?
There's a concern about leaking image decoding time. On one hand,
image.decode()
can leak the same information, however on the other hand,image.decode()
uses a promise, so engines can add arbitrary delays to avoid leaking the same information.We have some related discussions https://github.com/w3c/largest-contentful-paint/issues/111, https://github.com/WICG/element-timing/issues/65