These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:06 pm Advanced search

sandbox: tag proposal for html5

Do you think the HTML spec should do something differently? You can discuss spec feedback here, but you should send it to the WHATWG mailing list or file a bug in the W3C bugzilla for it to be considered.

sandbox: tag proposal for html5

Postby indus_khaitan » Mon Jan 21, 2008 9:56 am

A pre-formatted version of the complete proposal and other examples can be found on my blog at http://www.khaitan.org/blog/?page_id=203

The proposal is for a new tag called sandbox . sandbox provides hints to the user-agent for a fine grained and portable permission control of embedded content. The hints would tell the user-agent what the embedded content can/can't do.

The options of embedding content from multiple sources using widgets, embeds, etc., are growing dramatically with more and more user-generated content are being published, re-published and embedded within other pages. The content within the content (or micro-content) is (a) infrastructure driven, like embedding of scriptlets for web tracking (b) consumption driven, like widgets for news, weather, jobs (c) interaction driven, like videos, slideshows, micro-documents, spreadsheet snapshots and (d) submissions like search forms, data-capture fields, etc.

The micro-content in large part is distributed as a code fragment wrapped either in <script> or an <object>/<embed> tag. As the offering of these services grow, together things will become sophisticated and mature in coming years. How far this script should be trusted? At the onset, the following questions need answering:



    * Can the embedded script read the DOM of the page it is hosted in?
    * Can the script make further calls to the remote server using the script transport?
    * Can the script manipulate the CSS of the page it is hosted in?
    * Can the script attach event handlers?
    * Can the script call window.close() or document.replace() ?
    * Can the script launch a pop-up window while being rendered?
    * Is the script allowed to render non-textual content like video, audio, etc.?

In today’s HTML and the User-Agent world, all the questions may be answered as YES. An implementation of the proposed tag would allow the page author to control the permissions in a fine-grained way, instead of relying on browser specific configuration.

The IDL may look like this:

Code: Select all
interface HTMLSandboxElement : HTMLElement {
readonly attribute allowRemoting;
readonly attribute allowStyleChange;
readonly attribute allowDOMScripting;
readonly attribute allowEventHandler;
readonly attribute allowSubmit;
boolean checkPermission(in DOMString attributeName);
}


A sample HTML fragment (Web-Analytics example)

Code: Select all
<sandbox allowRemoting="0" allowStyleChange="0"
allowEventHandler="1" allowSubmit="0">
<script src="http://www.example-analytics.com/tracker.js" >
</script>
<script type="text/javascript">
_uacct = "UA-XXXXX";
Tracker();
</script>
</sandbox>


Benefits:

    * Fine-grained control while composing content (or application output) from multiple sources
    * Shared responsibility between page author and user-agent
    * Takes the browser security to a new level
    * Portable control instead of relying on individual user-agent configuration options for various permutations and combinations.


Thoughts?
Indus Khaitan
Last edited by indus_khaitan on Mon Jan 21, 2008 9:02 pm, edited 1 time in total.
indus_khaitan
<h6>
 
Posts: 3
Joined: Mon Jan 21, 2008 9:34 am
Location: Cupertino, CA

Postby zcorpan » Mon Jan 21, 2008 3:13 pm

zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby indus_khaitan » Mon Jan 21, 2008 9:00 pm

Adding to the original thought. The sandbox allows us to look at the security/permissions at a more comprehensive level rather than an individual script, iframe, object, div tag level and can be configured as such.

Does it make sense to take this take this discussion over to the lists? or attach this thought to an existing thread on w3 or whatwg list?
indus_khaitan
<h6>
 
Posts: 3
Joined: Mon Jan 21, 2008 9:34 am
Location: Cupertino, CA

Postby zcorpan » Tue Jan 22, 2008 2:06 am

Certainly, feel free to join the discussion on the list. :)
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby indus_khaitan » Tue Jan 22, 2008 6:37 am

:D
indus_khaitan
<h6>
 
Posts: 3
Joined: Mon Jan 21, 2008 9:34 am
Location: Cupertino, CA


Return to Feedback on the Specs

Who is online

Users browsing this forum: No registered users and 1 guest