Skip to content

Permissions-Policy generator

Free, no sign-up Runs in your browser

Build a Permissions-Policy header: choose who may use the camera, microphone, geolocation, payment, USB and other browser features. Correct syntax to copy.

Features

Your header

HTTP header
Permissions-Policy: camera=(), microphone=(), geolocation=()
nginx
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
Apache (mod_headers)
Header always set Permissions-Policy "camera=(), microphone=(), geolocation=()"

A frame from another origin also needs the allow attribute on its iframe tag to use a feature, even when the header lists that origin.

Everything you type here stays in your browser. Nothing is sent to HardenKit or to anyone else.

How to use the Permissions-Policy generator

  1. Set each feature the site does not use to Nobody.
  2. For a feature the site uses, choose this site only, or add the origins of the frames that need it.
  3. Show all features if you want to cover the experimental ones too.
  4. Copy the header or the nginx or Apache line.

About this tool

Permissions-Policy is a response header that switches browser features on or off for a page and for the frames inside it: camera, microphone, geolocation, payment, USB and many more. A feature that is switched off cannot be used by any script on the page, including a compromised dependency or an injected one, and the browser will not even show the permission prompt.

Each feature gets an allowlist. Empty parentheses mean nobody, self means the page’s own origin, a quoted origin adds that site, and * means everyone including embedded frames. The value is written in the structured-field syntax, so origins are in double quotes, self is not, and the items are separated by commas. That syntax is where hand-written headers usually go wrong, and it differs from the old Feature-Policy header.

A sensible policy lists the sensitive features the site does not use and sets them to nobody. Leave a feature unset to keep the browser default, which for most of them already blocks cross-origin frames. The list of features follows MDN; many are experimental and are recognised by Chromium browsers only, which simply ignore names they do not know.

Sources

Questions

What is the difference between Permissions-Policy and Feature-Policy?

Permissions-Policy replaced Feature-Policy. The idea is the same but the syntax changed: camera 'none' became camera=(), and origins are now quoted strings in parentheses. Feature-Policy is the deprecated older name, so new configs should send Permissions-Policy.

What does camera=() mean?

The parentheses hold the allowlist for the feature, and an empty list means no origin may use it. Neither the page nor any frame inside it can access the camera, and no permission prompt appears.

Do all browsers support Permissions-Policy?

Chromium browsers support the header and the widest set of features. Firefox and Safari have little or no support for the header and rely on the allow attribute of iframes. A browser ignores a header or a feature name it does not know, so sending it is safe everywhere.

Does an embedded iframe also need the allow attribute?

Yes. For a cross-origin frame to use a feature, the header must allow its origin and the iframe tag must carry an allow attribute naming the feature. The header sets the upper limit; the attribute delegates the feature to that frame.

Related tools