Permissions-Policy
The Permissions-Policy HTTP header (formerly known as Feature-Policy) allows site administrators to declare which powerful browser features and APIs can be used in the top-level page and in embedded iframes.
Why Restrict Browser Features?
Modern web browsers offer a vast array of APIs, including access to the user's camera, microphone, geolocation, and USB devices. While these features are powerful, they also expand the attack surface of your web application.
If your website does not need to access the user's microphone, you should explicitly disable the microphone API. This ensures that even if an attacker successfully injects a malicious script (e.g., via XSS), they cannot access the user's microphone.
Basic Example
Permissions-Policy: camera=(), microphone=(), geolocation=(self "https://trusted-site.com")
In this example:
camera=(): Access to the camera is completely disabled for all contexts.microphone=(): Access to the microphone is completely disabled for all contexts.geolocation=(self "https://trusted-site.com"): Geolocation is allowed for the same origin (self) and for the specified trusted origin.
Common Features to Restrict
For a standard website or blog, it is highly recommended to disable the following features if they are unused:
accelerometercamerageolocationgyroscopemagnetometermicrophonepaymentusb
Testing Your Policy
Because the list of controllable browser features is constantly expanding, it's a good idea to regularly audit your Permissions-Policy. Use our Security Headers Scanner to check if you have locked down unnecessary APIs.