Document Policy

Document Policy is a mechanism to allow documents to configure the web platform on which they operate: restricting certain behaviors or APIs, configuring defaults, or enabling new platform features. It also includes a way for documents to require such restrictions on sub-documents embedded in iframes. (The actual capabilities are intentionally vague here; this is a framework for individual features to be defined in, rather than being a set of concrete features itself)

Currently, it is not possible to restrict the surface area of the web platform on a per-document basis; Iframe sandboxing goes part of the way to help with this, but is difficult to extend, and has strict security-focused semantics. We would like to enable such ideas as: - Restricting the use of poorly-performing images - Disabling slow synchronous JS APIs - Configuring frame, image or script loading styles - Restricting overall document sizes or network usage - Restricting patterns which cause slow page re-layout among other things. These restrictions should be opt-in by developers, and do not necessarily need to extend to a frame's embedded content or popups. Feature policy has been proposed a number of times as a mechanism for accomplishing this, but the existing feature policy spec is not particularly well suited to it, as it has focused strongly on the "delegating powerful features to third parties" model. In particular, the syntax is designed around boolean feature states, and the processing model expects that frames cannot ever be configured independently of their embedders. Previous attempts to graft these ideas on to feature policy have resulted in a spec which is much harder to reason about, and more complex to implement and use, than having two distinct mechanisms. (see, for example, https://github.com/w3c/webappsec-feature-policy/issues/163, and https://github.com/w3c/webappsec-feature-policy/issues/252)

Documentation

Status in Chromium

Blink>FeaturePolicy


In development (tracking bug)

Consensus & Standardization

After a feature ships in Chrome, the values listed here are not guaranteed to be up to date.

  • No public signals
  • No public signals
  • No public signals
  • No signals

Owner

Last updated on 2019-08-21