XUL iframe/browser elements w/o type attribute probably have too high privileges
Categories
(Core :: XUL, defect)
Tracking
()
People
(Reporter: glazou, Unassigned)
References
Details
(Keywords: dev-doc-needed, sec-want, Whiteboard: [sg:want] unsafe default)
Updated•17 years ago
|
Comment 1•17 years ago
|
||
Comment 2•17 years ago
|
||
Updated•17 years ago
|
Comment 3•17 years ago
|
||
Comment 4•17 years ago
|
||
Comment 5•17 years ago
|
||
Comment 6•17 years ago
|
||
Comment 7•17 years ago
|
||
Comment 8•17 years ago
|
||
Comment 9•17 years ago
|
||
Comment 10•17 years ago
|
||
Comment 11•17 years ago
|
||
Comment 12•17 years ago
|
||
Comment 14•17 years ago
|
||
Comment 15•17 years ago
|
||
Comment 16•17 years ago
|
||
Comment 17•17 years ago
|
||
Updated•10 years ago
|
Updated•9 years ago
|
Comment 18•5 years ago
|
||
The surface area here is much smaller than before - addons aren't able to create XUL iframes/browsers so we control the consumers and can be careful to set type=content in our own code when needed.
That said, I do notice that we generally use type=content more often than not (https://searchfox.org/mozilla-central/search?q=%3Cbrowser&case=false®exp=false&path=.xhtml and https://searchfox.org/mozilla-central/search?q=createXULElement(%22browser%22&case=false®exp=false&path=).
Perhaps we should change the default behavior of the [type] checks (like https://searchfox.org/mozilla-central/search?q=TypeAttrName&case=false®exp=false&path=) to treat a nonexistent type attribute as [type=content] and then use [type=chrome] to explicitly opt in to the current default behavior. Looks like that would remove some code on net (many JS setAttributes and the attribute in markup) and maybe be a better default. Not sure.. Nika, what do you think?
Comment 19•5 years ago
|
||
I imagine we should probably make XUL browser be type=content by default (perhaps even preventing it from being not type=content?), though I'm less sure about the general XUL iframe case. It's not super supported to have frames hosting untrusted content which aren't remote <browser> elements anymore, so it seems a bit odd to have the default behaviour be pseudo-secure with them, despite not providing a proper process boundary. Making more internal code treat XUL browser and XUL iframe differently could be unfortunate, though.
The main risk here, I think, is with the number of changes to tests and other unrelated code which would be required to land this change. If someone was willing to do all of the validation work required for that, though, my intuition suggests this could be a reasonable change and may make working with browsers less error-prone.
Comment 20•5 years ago
•
|
||
(In reply to :Nika Layzell (ni? for response) from comment #19)
I imagine we should probably make XUL
browserbetype=contentby default (perhaps even preventing it from being nottype=content?), though I'm less sure about the general XULiframecase. It's not super supported to have frames hosting untrusted content which aren't remote<browser>elements anymore, so it seems a bit odd to have the default behaviour be pseudo-secure with them, despite not providing a proper process boundary. Making more internal code treat XULbrowserand XULiframedifferently could be unfortunate, though.The main risk here, I think, is with the number of changes to tests and other unrelated code which would be required to land this change. If someone was willing to do all of the validation work required for that, though, my intuition suggests this could be a reasonable change and may make working with browsers less error-prone.
Would it be possible to remove xul:iframe entirely and replace consumers with html:iframe? Or I guess xul:browser[type=chrome] if that didn't work. From a quick search, in non-tests we seem to only have a few xul iframes created from JS (https://searchfox.org/mozilla-central/search?q=createXULElement(%22iframe&case=false ) and none in markup (https://searchfox.org/mozilla-central/search?q=%3Ciframe&case=false®exp=false&path=.xhtml)
Comment 21•5 years ago
|
||
I'm not sure. FWIW I believe we do use xul:iframe with type=content in a few places, at least in tests, but I think also in devtools. I think we'd probably have to try to make the replacements in order to know for certain whether or not doing it is possible.
Updated•3 years ago
|
Description
•