Resubmitting an issue from w3c/webappsec#543
I would like to propose a way to restrict iframe from programmatically setting focus on any of its inputs. Restricting would mean that the .focus() calls inside the iframe would have no effect. I am proposing that it could be achieved with a new feature policy or a sandbox flag, not sure which one suits more to this case:
sandbox:
<iframe src="ad.html" sandbox="allow-focus-calls"><iframe>
feature policy:
<iframe src="ad.html" allow="focus-calls"><iframe>
(The name of the flag is just an example. Feel free to propose a better name)
I am a Software Engineer working on advertising security for a house of large online publishers (Yahoo, Tumblr, HuffPost, TechCrunch, AOL to name a few). The reason behind this proposal is that it gives a way for publishers to improve the security of visitors by restricting the ability for (malicious) ads to programmatically steal focus without users noticing.
Example:
<html>
<body>
<h1>Top page</h1>
<iframe src="ad.html"><iframe>
</body>
</html>
<html>
<body>
<p>Iframe</p>
<input id="textInput" type="text">
<script>
document.getElementById('textInput').focus();
</script>
</body>
</html>
The iframe in the example 'steals' focus from the top page as soon as it loads.
Resubmitting an issue from w3c/webappsec#543
I would like to propose a way to restrict iframe from programmatically setting focus on any of its inputs. Restricting would mean that the .focus() calls inside the iframe would have no effect. I am proposing that it could be achieved with a new feature policy or a sandbox flag, not sure which one suits more to this case:
sandbox:
<iframe src="ad.html" sandbox="allow-focus-calls"><iframe>feature policy:
<iframe src="ad.html" allow="focus-calls"><iframe>(The name of the flag is just an example. Feel free to propose a better name)
I am a Software Engineer working on advertising security for a house of large online publishers (Yahoo, Tumblr, HuffPost, TechCrunch, AOL to name a few). The reason behind this proposal is that it gives a way for publishers to improve the security of visitors by restricting the ability for (malicious) ads to programmatically steal focus without users noticing.
Example:
The iframe in the example 'steals' focus from the top page as soon as it loads.