CSP Directive Proposal: Sandbox

I'd like to propose the following CSP directive:

Syntax:

directive-name = "sandbox"
directive-value = sandbox-policy

sandbox-policy = "" / sandbox-flag *( 1*LWS sandbox-flag )
sandbox-flag = "allow-same-origin" / "allow-top-navigation" /
"allow-forms" / "allow-scripts"

Semantics:

Essentially, the user agent would apply the same security rules from
<http://www.whatwg.org/specs/web-apps/current-work/#attr-iframe-sandbox>
(e.g., as if the document were contained in an iframe with the
corresponding sandbox attribute).

Example:

Content-Security-Policy: sandbox allow-scripts

This policy would allow the document to run scripts, but the document
would have a "unique origin" as its security context, so it wouldn't
be able to do things like access document.cookie or localStorage.

Thoughts?
Adam

Received on Monday, 21 February 2011 10:39:32 UTC