Re: [csswg-drafts] [css-sizing][repsonsive-iframe] The behavior when content navigates out (#13589)

The CSS Working Group just discussed `[css-sizing][repsonsive-iframe] The behavior when content navigates out`, and agreed to the following:

* `RESOLVED: For same-origin navigations we definitely keep the size`
* `RESOLVED: Once we know the navigated-to page doesn't opt-in, we clear the intrinsic size`
* `RESOLVED: Once we know the new page is not opted-in, we clear the size`
* `RESOLVED: Check with security folks whether cross-origin case leaking info is an issue that needs mitigation`

<details><summary>The full IRC log of that discussion</summary>
&lt;emilio> koji: smfr pointed out that we should define what happens when content navigates<br>
&lt;emilio> ... when content navigates in the iframe gets the natural size from it<br>
&lt;emilio> ... but when navigating out we can set to initial size, or keep the previous size<br>
&lt;TabAtkins> q+<br>
&lt;emilio> ... keeping is more natural from a user POV but can leak previous content size to the new content<br>
&lt;emilio> ... resetting stops that, but it can cause the size to jump<br>
&lt;emilio> ... we think we prefer to keep the last size<br>
&lt;iank_> (note the leak already somewhat happens with polyfills of this feature)<br>
&lt;emilio> q+<br>
&lt;emilio> ... it potentially leaks some information tho<br>
&lt;Rossen> ack TabAtkins<br>
&lt;emilio> TabAtkins: You wouldn't be able to tell that the size comes from anywhere else right?<br>
&lt;emilio> ... if you resize an iframe that's the size you get so you can't distinguish it<br>
&lt;emilio> ... worst case we could distinguish same vs. cross-origin navs<br>
&lt;emilio> ... but it should be fine to preserve the size I think<br>
&lt;TabAtkins> emilio: is the risk here... if th enavigation is triggered by the frame itself, it can already communicate that info<br>
&lt;TabAtkins> emilio: if nav is triggered by parent, parent can also communicate<br>
&lt;TabAtkins> emilio: so it seems to me, the reason this is aleady exposed in the polyfill is because the parent is coordinate the size<br>
&lt;TabAtkins> emilio: and at that point the comm channel is the embedder, the parent page<br>
&lt;TabAtkins> emilio: i dont' think you can communicate something with this that you couldn't comm via the query string, if the iframe is navigating itself<br>
&lt;TabAtkins> emilio: am i missing something?<br>
&lt;TabAtkins> emilio: so whats' the risk otherwise?<br>
&lt;TabAtkins> emilio: I guess an unintentional leak<br>
&lt;TabAtkins> emilio: but then you can't distinguish it from the page setting the size<br>
&lt;TabAtkins> ian: I think if we don't do it people will add a resize to the iframe and write the values in manually anyway<br>
&lt;emilio> iank_: if we don't do this people will just write the values in with a resizeobserver so they stick<br>
&lt;emilio> emilio: seems fine to me but would be good to get smfr or someone else from Apple to confirm<br>
&lt;emilio> PROPOSED: Keep previous size from the navigated away content<br>
&lt;emilio> q+<br>
&lt;emilio> Rossen: curious about what privacy / sec teams would thing<br>
&lt;emilio> ... I see iank_'s point about people being able to do this but that's a bit of cargo culting<br>
&lt;TabAtkins> emilio: what beahvior do we want once we've loaded the incoming page, and we see it's not opted in?<br>
&lt;TabAtkins> emilio: at that point do we want to clear the previous size?<br>
&lt;TabAtkins> Rossen: the previous size coudl be partial/incomplete anyway<br>
&lt;iank_> could we resolve to keep the size then simon/etc can follow up if needed?<br>
&lt;TabAtkins> emilio: that does give you a bit of extra info...<br>
&lt;smfr> ok by me<br>
&lt;TabAtkins> emilio: q is just do we want to keep the previous size or reset<br>
&lt;TabAtkins> Rossen: does this work cross-origin?<br>
&lt;TabAtkins> TabAtkins: yeah<br>
&lt;TabAtkins> Rossen: oh then def reset, yeah<br>
&lt;TabAtkins> emilio: well the cross-origin can see the value of the previous page, so leaking to cross-origin is already there<br>
&lt;iank_> it adds visual jump when it isn't needed. the polyfills today don't have this jump<br>
&lt;TabAtkins> Rossen: I think cross-origin navs should always reset eagerly<br>
&lt;TabAtkins> iank_: what's your threat model here?<br>
&lt;TabAtkins> Rossen: it exposes info you wouldn't otherwise have<br>
&lt;emilio> ack emilio<br>
&lt;TabAtkins> iank_: you can't determine how you got that info, tho<br>
&lt;TabAtkins> iank_: if the outside page sets `height:160px`, the cross-origin frame gets that 160px<br>
&lt;TabAtkins> iank_: no different from the value coming from frame-sizing<br>
&lt;TabAtkins> iank_: so i don't think clearing the info is useful...<br>
&lt;TabAtkins> emilio: resetting gives you more info. if you embed a cross-origin and you navigate to a different origin, cna the embedder know about that navigation?<br>
&lt;TabAtkins> emilio: can you get the url of the iframe?<br>
&lt;TabAtkins> emilio: but if you reset, then the resize would expose that<br>
&lt;fantasai> TabAtkins: wouldn't necessarily expose, because page can request size update<br>
&lt;fantasai> TabAtkins: if can't observe cross-origin, can't tell if it's due to cross-origin change or whether page requested a resize<br>
&lt;Rossen> ack fantasai<br>
&lt;emilio> fantasai: we seem to have agreement to preserve this at least for same-origin<br>
&lt;emilio> TabAtkins: yes<br>
&lt;emilio> fantasai: we can resolve on that<br>
&lt;emilio> PROPOSED: For same-origin navigations we definitely keep the size<br>
&lt;emilio> RESOLVED: For same-origin navigations we definitely keep the size<br>
&lt;emilio> fantasai: the other interesting question is what happens if the new page doesn't opt in<br>
&lt;emilio> ... do we resize to the initial size or we roll with the previous natural size<br>
&lt;emilio> emilio: it's probably more consistent to reset it, it'd be weird for the same page to give two different renderings depending on whether the navigated-from page happened to get measured or not<br>
&lt;fantasai> emilio++<br>
&lt;TabAtkins> +1<br>
&lt;emilio> PROPOSED: Once we know the new page is not opted-in, we reset the size<br>
&lt;TabAtkins> emilio: so imagine you ahve a page that opts in, it's an interstitial page<br>
&lt;TabAtkins> emilio: everything checks out, we measure the size and adjust<br>
&lt;TabAtkins> emilio: but it would be weird if navigating *before* DOMContentLoaded gave one rendering (the initial size) and navigating *Aafter* gave another (the measured size)<br>
&lt;TabAtkins> koji: so once we hit the &lt;/head> tag, we relayout<br>
&lt;TabAtkins> emilio: Yeah, once we know the page is not opting in, you'll clear the size and probably relayout<br>
&lt;TabAtkins> fantasai: probably worse to base it on DOMCotnentLoaded, want it as fast as possible<br>
&lt;TabAtkins> emilio: right, so &lt;/head> tag<br>
&lt;TabAtkins> koji: so what does it help? the page can still see the previous size<br>
&lt;TabAtkins> fantasai: thi sisn't security<br>
&lt;TabAtkins> fantasai: just, if the page hasn't opted in, it should lay out different based on whether it was *navigated to* by an opted-in page or not<br>
&lt;TabAtkins> s/it should/it shouldn't/<br>
&lt;fantasai> fantasai: whether previous page was tall or short, shouldn't change the rendering of this page (which has not opted in)<br>
&lt;emilio> fantasai: it's not only about whether you've navigated in the middle but also about whether it's a tall or short page<br>
&lt;emilio> koji: so when the child page it closes the `&lt;/head>` it sends a message to the parent process and resize<br>
&lt;emilio> ... at that point you'd have to relayout<br>
&lt;emilio> ... but it is fine to do multiple layouts here<br>
&lt;emilio> iank_: the info leak is happening regardless right?<br>
&lt;emilio> emilio: yeah this is just about getting consistent rendering<br>
&lt;emilio> PROPOSED: Once we know the navigated-to page doesn't opt-in, we clear the intrinsic size<br>
&lt;fantasai> PROPOSED: Once we know the new page is not opted-in, we reset the size<br>
&lt;TabAtkins> (and we always keep the previous page's size until then, regardless)<br>
&lt;emilio> RESOLVED: Once we know the navigated-to page doesn't opt-in, we clear the intrinsic size<br>
&lt;fantasai> RESOLVED: Once we know the new page is not opted-in, we clear the size<br>
&lt;emilio> fantasai: now remaining question is do we reset the size for cross-origin navigations or not<br>
&lt;emilio> ... (regardless of whether it's opted in)<br>
&lt;emilio> ... I think there's several things, one is preserving the size, the other is resetting the size as soon as it's cross-origin, the other one is to pretend to reset the size so that it's laid out into a default size container<br>
&lt;emilio> q+<br>
&lt;smfr> pretending sounds complicated<br>
&lt;emilio> ... so the page is pretending to see the default viewport<br>
&lt;emilio> emilio: observable via window.innerHeight<br>
&lt;Rossen> smfr +1<br>
&lt;fantasai> s/several things/several options/<br>
&lt;TabAtkins> emilio: in the pretending version, a few options<br>
&lt;TabAtkins> emilio: one is pretending frame-sizing isn't set, the other is pretending you're fixed size 300x150<br>
&lt;TabAtkins> emilio: former is especially bad, you don't know the size you'd have without frame-sizing without rerunnign layout<br>
&lt;TabAtkins> emilio: so my pref is, if we don't have concrete attack vectors, i'd like to just preserve the previous page's size<br>
&lt;TabAtkins> emilio: if we do, i like enforcing a 300x150 size for the iframe's document<br>
&lt;TabAtkins> emilio: that does change beahvior for existing docs<br>
&lt;TabAtkins> emilio: so my prefer is just not pretend and preserve the size<br>
&lt;iank_> +1 to emilio - we don't want to trigger a layout on the main frame for this purpose.<br>
&lt;TabAtkins> emilio: i don't think there's an attack vector<br>
&lt;emilio> iank_: I'm struggling to see what the attack vector would be<br>
&lt;emilio> ... but +1 to what emilio said<br>
&lt;emilio> smfr: if this is a payment flow the site might depend on whether apple pay or other method information is in use for example<br>
&lt;emilio> iank_: but you don't know if that size was imposed by the parent page or not<br>
&lt;emilio> smfr: not sure I agree, the site can assume if it knows it's using frame-sizing<br>
&lt;fantasai> iank_: Same as polyfill case<br>
&lt;emilio> iank_: not different from a page using the polyfill and exposing this<br>
&lt;emilio> emilio: in that case it's explicit, the parent is acting as a coordinator<br>
&lt;fantasai> emilio: Yeah, but in that case it's more explicit. Parent page is doing it explicitly<br>
&lt;emilio> smfr: that sounds like a bad polyfill<br>
&lt;fantasai> TabAtkins: polyfill wouldn't do the flickering behavior, it's bad<br>
&lt;smfr> (bad for privacy, not bad for flicker)<br>
&lt;fantasai> emilio: In this case, you don't require flicker necessarily. You can layout the child page with a 300x150 viewport unconditionally without changing layout of outer frame<br>
&lt;fantasai> emilio: from pov of parent, the size hasn't changed. So flicker isn't that bad.<br>
&lt;fantasai> TabAtkins: you're talking about the pretending case<br>
&lt;fantasai> emilio: Right, that's not possible to do in a polyfill<br>
&lt;fantasai> emilio: Has Google run this through security team?<br>
&lt;fantasai> emilio: To me, I find it very hard to come up with a realistic enough case ... maybe the payment processor example from Simon<br>
&lt;fantasai> emilio: If it's sensitive, before navigating away the previous page could size itself to zero and call this API<br>
&lt;fantasai> emilio: otherwise, there's no way to distinguish whether size is set by embedder or not<br>
&lt;emilio> fantasai: a sensitive page would ideally not opt-in?<br>
&lt;emilio> koji: I think what you're saying is equivalent to the child page sending the size to the parent<br>
&lt;emilio> ... if that child page navigates to a bad page<br>
&lt;emilio> ... I don't see much difference<br>
&lt;fantasai> emilio: originating page needs to have the meta opt-in<br>
&lt;fantasai> ... there's 2 pages, A and B in different origins.<br>
&lt;fantasai> ... let's say A has different sizes depending on whether you have Apple Pay<br>
&lt;fantasai> ... and page B wants to know<br>
&lt;fantasai> ... if page B opts in via meta tag<br>
&lt;fantasai> ... The only way for page A to not expose its content size would be<br>
&lt;fantasai> ... before navigating to clear the size<br>
&lt;fantasai> ... It is possible not to leak it, but do we want that to be the behavior.<br>
&lt;fantasai> ... In polyfill the parent page is coordinating between both<br>
&lt;Rossen> q?<br>
&lt;Rossen> ack emilio<br>
&lt;emilio> Rossen: what if we take the conservative resolution to pretend 300x150 and then based on conversations with experts we can come back and change it<br>
&lt;emilio> q+<br>
&lt;Rossen> ack emilio<br>
&lt;emilio> emilio: My concern with that is that unless we do the same for /all/ cross-origin iframes, then you're exposing different information (whether you were navigated from or not, or whether or not your parent uses frame-sizing)<br>
&lt;fantasai> emilio: Would be good to check with security folks whether they thing this is a real attack vector<br>
&lt;emilio> ... and doing it for all cross-origin iframes is a behavior change / performance issue<br>
&lt;fantasai> PROPOSED: Check with security folks whether cross-origin case leaking info is a real concern<br>
&lt;fantasai> PROPOSED: Check with security folks whether cross-origin case leaking info is an issue that needs mitigation<br>
&lt;fantasai> RESOLVED: Check with security folks whether cross-origin case leaking info is an issue that needs mitigation<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/13589#issuecomment-4165477000 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 31 March 2026 20:55:59 UTC