You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're considering removing the feature because it's adding complexity to the style recalculation engine. Specifically, when working to improve style recalculation performance, we've often run into code and complexity that exists only to serve iframe@seamless. Removing that code and complexity will let us improve style recalculation performance faster.
But while we’re not interested in the style component of the seamless
attribute, we – and probably all developers that hack on iframes – are
interested in the resizing behaviour it introduces. Right now we deploy
fairly complex code, both inside the iframed document, and on the parent
document, to resize the iframe element when the iframed content changes
size [2]. Every iframed application with dynamically-sized content does the
same.
To me, it’s crazy that it’s 2013 and there’s still no native way to have
the browser automatically resize an iframe. And yet we have seamless. But
it not only resizes: it adds all this other bundled behaviour, and strictly
serves a fringe use case where somebody is distributing iframes on the same
origin.
My suggestion is to split seamless into its three major parts: style
inheritance, iframe resizing, and browsing context.
So I think the gist of it all both from the implementor side and the web-dev side is that seamless as-specced doesn’t seem to be what anybody wanted to begin with. Or at least it’s more than anybody actually wanted. And anyway like @annevk says, it’s seems a lot of it’s since been “overcome by events” in light of Shadow DOM.
Reacted by Mr Beedell, Roke Julian Lockhart and Norm X
It seems like the issue is that "seamless" inherited styles, which seemed foolish to begin with. I think "seamless" would be fine if it simply "autofit" it's content, such that embedding an iframe could effect the document flow of the document its embedded in. It's too bad this wasn't just added back in with just auto-resizing.
Reacted by Felix Becker, monckey100 and Ben Bucksch
I'd still find it useful if a CORS check allowed me to combine sandbox (or a second domain) and seamless to load pages I control which then contain <script> embeds for things like Disqus.
Having variable-length resources in a scrollable iframe really isn't the best user experience most of the time but, at the very least, I'd really like to be able to keep all remotely loaded content from running in the same origin as my pages.
@rniwa I don't see how that would be possible; there are too many variables on load time, and detailed eventing would be presumably sandboxed. There are how many billions or trillions of web pages? How could you reliably profile page loads for pages that may change, and over connections that vary in latency throughout the day/week?
Hmm, still.... a theoretical successful detection doesn't equate to real-world exploits, as one of the requirements of such an exploit would be injection into the page hosting the iframe, or a user unwittingly installing a malicious script into their webpage. Even the calculate style vulnerability of the past relied on malicious scripts being allowed access in the first place.
Instead of limiting the utility of useful features of the web, maybe we should focus on the root cause, which is un-sandboxed third-party scripts having full access to the host environment instead of a limited or white-listed API. It just seems unfortunate if a very useful feature of the web becomes a casualty of poor design elsewhere.
It seems like the issue is that "seamless" inherited styles, which seemed foolish to begin with. I think "seamless" would be fine if it simply "autofit" it's content, such that embedding an iframe could effect the document flow of the document its embedded in. It's too bad this wasn't just added back in with just auto-resizing.
+1
I desperately need autofit sandboxed iframes in many of my apps. Essentially whenever I want to show untrusted HTML. In many realistic use cases (web forums, conversation view, user-supplied descriptions on an app store, reviews, comments, etc), I want the iframe element to size to its content. In such cases, the sandboxed iframe is an additional protection, on top of sanitizing. It also prevents CSS styles from leaking into the parent doc.
You can detect what kind of content was shown inside the frame based on how long it look to layout / style / paint.
The irony is that because this feature was rejected, the fallback is what it has always been, which is to force a user to include a 3rd-party script in their page, in order to properly create and size the iframe. So the rejection of this feature does not make sense, because for whatever security concerns there are, the effective result of not having it are worse from a security perspective, and more subject to cross-site scripting / man-in-the-middle attacks, so I hope that someday this can be revisited and that can be part of the conversation. So, if there are theoretical attacks from layout / style / paint (which I don't really believe browsers cannot mitigate from varying timings slightly), it seems to be relatively minor vs. the real-world cost from the fact that this feature still does not exist.
I like the idea of auto-sizing iframes though I think a few things need to be cleared up:
Timing attacks aren't hypothetical issues but are an important part of what browsers have to deal with. In 2018, the famous Spectre and Meltdown vulnerabilities were discovered which were based on timing attacks. To prevent pages in a browser from using the vulnerabilities to peek at information in each other, browsers had to suddenly rework how iframes were implemented and had to remove their existing support for SharedArrayBuffer and WebAssembly multithreading until new CORS headers were implemented that allowed sites to use them safely. The caution in this thread looks very justified in retrospect.
The security issues could likely be dealt with by requiring pages to opt in through a header to supporting auto-sizing when inside of an auto-sizing iframe. (There are existing examples of security issues being solved like this such as in the X-Frame-Options header, the CSP "frame-ancestors" directive, CORS headers, etc.)
Auto-sizing iframes (where both sides have to opt in) would be merely a convenience feature, as to my knowledge it's already possible with some javascript on both sides of an iframe without needing to unsafely load scripts from third-party domains, so it's definitely not worth doing in a way that adds a vulnerability. (If it's not already possible to cleanly do with cooperating javascript on both sides, then it might be a smaller/easier/quicker change for browsers to fix that first.)
Activity
foolip commentedon Nov 12, 2015
Are the use cases for this simply left unsolved, or is it being done cooperatively with postMessage between the embedder and embedded frame?
annevk commentedon Nov 13, 2015
I don't think that solves all equally well, but it seems like shadow DOM solves most of them pretty well.
foolip commentedon Nov 14, 2015
Support was removed from Blink in January 2014, and from the blink-dev discussion I take the sentiment to be more disinterest than disapproval.
It would be interesting to hear if there are fundamental problems with the feature, but it would take active implementor interest to save it.
sideshowbarker commentedon Dec 9, 2015
I notice that in one of Adam Barth’s comments in the thread you cited, he says:
As far as web-developer feedback on the feature, some comments from Ben Vinegar from last year are worth reading; among other things he says:
So I think the gist of it all both from the implementor side and the web-dev side is that
seamlessas-specced doesn’t seem to be what anybody wanted to begin with. Or at least it’s more than anybody actually wanted. And anyway like @annevk says, it’s seems a lot of it’s since been “overcome by events” in light of Shadow DOM.annevk commentedon Dec 14, 2015
Note also that seamless requires changes to the event model that have never been specified.
Ritsyy commentedon Jan 7, 2016
how should the removal of iframe seamless change for browsing context , as it would take a lot of changes for it's spec.
annevk commentedon Jan 7, 2016
Yeah, things that look like they can be removed:
Basically everything that builds on top of the seamless feature can go.
Ritsyy commentedon Jan 7, 2016
okay @annevk , will remove the dependent spec on seamless feature.
annevk commentedon Jan 22, 2016
This was removed in 1490eba. My mistake for not linking it all together.
annevk commentedon Jan 22, 2016
Thank you @Ritsyy for making it happen! (And persisting despite my nitpicking. 😊)
Ritsyy commentedon Jan 22, 2016
@annevk Learned a lot from this bug, thank you so much for all the reviews :)
9 remaining items
matthew-dean commentedon Feb 18, 2017
It seems like the issue is that "seamless" inherited styles, which seemed foolish to begin with. I think "seamless" would be fine if it simply "autofit" it's content, such that embedding an iframe could effect the document flow of the document its embedded in. It's too bad this wasn't just added back in with just auto-resizing.
rniwa commentedon Feb 18, 2017
Note that auto-fitting the height turned out be a serious timing attack vector unless we restricted with CORS.
matthew-dean commentedon Feb 18, 2017
@rniwa Oh? How did that make a site vulnerable?
rniwa commentedon Feb 18, 2017
@matthew-dean : You can detect what kind of content was shown inside the frame based on how long it look to layout / style / paint.
ssokolow commentedon Feb 18, 2017
I'd still find it useful if a CORS check allowed me to combine
sandbox(or a second domain) andseamlessto load pages I control which then contain<script>embeds for things like Disqus.Having variable-length resources in a scrollable iframe really isn't the best user experience most of the time but, at the very least, I'd really like to be able to keep all remotely loaded content from running in the same origin as my pages.
matthew-dean commentedon Feb 20, 2017
@rniwa I don't see how that would be possible; there are too many variables on load time, and detailed eventing would be presumably sandboxed. There are how many billions or trillions of web pages? How could you reliably profile page loads for pages that may change, and over connections that vary in latency throughout the day/week?
rniwa commentedon Feb 20, 2017
Well, timing attack is typically done on a very specific website, which the attacker knows. A typical timing attack is robust against websites changing its content. You can read various research paper on this matter. e.g. https://www.contextis.com/documents/2/Browser_Timing_Attacks.pdf
matthew-dean commentedon Feb 20, 2017
Hmm, still.... a theoretical successful detection doesn't equate to real-world exploits, as one of the requirements of such an exploit would be injection into the page hosting the iframe, or a user unwittingly installing a malicious script into their webpage. Even the calculate style vulnerability of the past relied on malicious scripts being allowed access in the first place.
Instead of limiting the utility of useful features of the web, maybe we should focus on the root cause, which is un-sandboxed third-party scripts having full access to the host environment instead of a limited or white-listed API. It just seems unfortunate if a very useful feature of the web becomes a casualty of poor design elsewhere.
benbucksch commentedon May 29, 2024
+1
I desperately need autofit sandboxed iframes in many of my apps. Essentially whenever I want to show untrusted HTML. In many realistic use cases (web forums, conversation view, user-supplied descriptions on an app store, reviews, comments, etc), I want the iframe element to size to its content. In such cases, the sandboxed iframe is an additional protection, on top of sanitizing. It also prevents CSS styles from leaking into the parent doc.
matthew-dean commentedon Aug 14, 2024
This issue, and
iframe seamlessseems like an example of making perfect the enemy of good.This was removed because, as @rniwa states:
The irony is that because this feature was rejected, the fallback is what it has always been, which is to force a user to include a 3rd-party script in their page, in order to properly create and size the iframe. So the rejection of this feature does not make sense, because for whatever security concerns there are, the effective result of not having it are worse from a security perspective, and more subject to cross-site scripting / man-in-the-middle attacks, so I hope that someday this can be revisited and that can be part of the conversation. So, if there are theoretical attacks from layout / style / paint (which I don't really believe browsers cannot mitigate from varying timings slightly), it seems to be relatively minor vs. the real-world cost from the fact that this feature still does not exist.
Macil commentedon Aug 15, 2024
I like the idea of auto-sizing iframes though I think a few things need to be cleared up: