Permissions-Policy HTTP Header

Nowadays, the issue of online privacy has become a top priority for both internet users and developers. As we surf the web, we encounter many websites and applications that often request access to our personal information and our device’s resources. This has created a critical need to manage and control who and what can access our data and the features of our web browser, and here’s where Permissions-Policy comes into play.

Our article will provide an in-depth exploration of what Permissions-Policy is, how it operates, and why it’s key for protecting your online privacy. We’ll dig into how this technology strikes a balance between the functionality of the web and the security of your data, granting you the power to take charge of your online experience.

What is Permissions-Policy?

Permissions-Policy is a technology that ensures a safer and more regulated online experience. In our current age, modern web pages are far more than static documents like back in the 90s; they’ve evolved into interactive applications that can access various sensitive resources, such as your camera, microphone, location, and more.

This header consists of a group of rules that enable web developers to specify which resources can be accessed and the ways in which they can be utilized. Essentially, it acts as a protective barrier for your data and hardware, ensuring that they are only shared with trusted sources and for legitimate purposes.

The role of the Permissions-Policy header

The Permissions-Policy header is a very important component of web security protocols that assists websites in managing and controlling how various browser features and APIs operate on a user’s device. This header is employed to establish particular limitations and authorizations for a webpage, contributing to heightened user privacy and security.

In simple terms, the header allows developers to define rules regarding access to specific browser functions, such as the camera, microphone, geolocation, and push notifications. By specifying these rules, developers can determine who can access these functions and the circumstances under which access is permitted. This is particularly important in an online environment where safeguarding user privacy and security is a top concern.

Mozilla docs say that “Permissions Policy provides mechanisms for web developers to explicitly declare what functionality can and cannot be used on a website.”

Furthermore, apart from increasing security and privacy, the Permissions-Policy header helps developers maintain a consistent and predictable user experience by denying unauthorized access to sensitive features. This leads to a reduced risk of security breaches and it also decreases exposure to potential misuse.

Permissions-Policy

Is Permissions-Policy important?

This header plays a key role in online security and user privacy. As we have previously stated, this policy establishes the guidelines that determine what actions and resources a website can access and utilize in a user’s web browser. It’s a critical feature because it enforces strict control over how requests for access to features like the camera, microphone, and location are handled on a website.

Permissions-Policy is a must for preserving user privacy and security on the internet, preventing unauthorized or malicious websites from gaining access to sensitive information without user consent, and it’s a shield against security threats like identity theft and data breaches.

So, to make it simple, the answer is yes, Permissions-Policy is a very important feature in safeguarding online privacy and security. It ensures websites adhere to ethical and legal standards while delivering a secure and trustworthy user experience.

According to Webtechsurvey.com, 1.24% of websites use this header. Is your site among them? You can find out using our webserver security test.

The difference between Permissions-Policy and Feature Policy

What we used to know as Feature Policy is now referred to as Permissions Policy, along with another protocol called Document Policy. Basically, Feature Policy technology has been replaced by Permissions Policy and Document Policy to the extent that Feature Policy is now considered obsolete.

This change was made to more accurately reflect the name of the header by splitting it into the two mentioned policies. The change also brought about some adjustments to the structure, attributes, and more. In other words, Feature Policy has essentially been renamed to Permissions Policy and now has some slight differences. So, to maintain the best compatibility with modern browsers, it is recommended to use Permissions Policy.

Checking Permissions-Policy

The easiest and fastest way to check for this header is by using a tool known as Curl. Simply open up a new terminal on your system, and run the following:

curl -I https://yourwebsite.com

Obviously, you have to replace “yourwebsite.com” with your real website domain. The Curl output will display various headers, including Permissions-Policy, which will return the configuration from your web server. For example, if you have included only camera and microphone, the result should look like this:

Permissions-Policy: camera=(); microphone=();

Permissions-Policy directives

The Permissions-Policy directives are specified within the HTTP header, and they can be configured to set permission policies for a range of features and functions. Some common directives include:

  • geolocation: This directive determines whether the website can access the user’s location.
  • camera: It decides whether the website can use the device’s camera.
  • microphone: It controls access to the device’s microphone.
  • accelerometer, gyroscope, magnetometer: These directives regulate access to device sensors.
  • fullscreen: It governs whether the website can request full-screen mode.
  • payment: It defines whether the site has permission to access payment-related features in the browser.
  • usb: This directive manages access to USB devices from the browser.
  • autoplay: It determines whether multimedia content, like videos and audio, can play automatically.

Permissions-Policy directives can be set with different values, such as “self” to allow access only from the website itself, “none” to deny access, and other specific values based on the website’s requirements.

Permissions-Policy examples

Here you can check some instances of the directives set within the HTTP header:

  • Authorize access to the camera and geolocation exclusively for the current website:
Permissions-Policy: camera=self, geolocation=self
  • Allow the utilization of all sensors and the microphone on the current website:
Permissions-Policy: accelerometer=self, gyroscope=self, magnetometer=self, microphone=self
  • Enable automatic playback of multimedia content solely from the current website:
Permissions-Policy: autoplay=self
  • Permit access to the USB port solely for the current website:
Permissions-Policy: usb=self
  • Grant access to the full-screen mode only for the current website:
Permissions-Policy: fullscreen=self
  • Provide access to payment-related features exclusively for the current website:
Permissions-Policy: payment=self
  • Allow geolocation access from the current website and any other site that meets specific origin criteria:
Permissions-Policy: geolocation=self, geolocation="https://example.com https://anotherexample.com"

How to configure Permissions-Policy

Let’s see how to set this header in some common web servers like Nginx and Apache.

Setting up Permissions-Policy in Apache

First, let’s configure the Permissions-Policy header in Apache. Most Linux distributions store the primary Apache configuration file at /etc/apache2/apache2.conf. However, you can also configure this directive in specific virtual host configuration files.

Open the configuration file using a text editor such as nano or vim. You can use the following command:

nano /etc/apache2/apache2.conf

Add the directive within the VirtualHost or Directory section where you want to apply it. Here’s an example of what the directive might look like:

Header set Permissions-Policy "geolocation=(), microphone=(), camera=()"

In this example, we’ve configured a policy that limits access to geolocation, microphone, and camera in the browser.

Save the file and restart Apache to apply changes:

systemctl restart apache2

Enabling Permissions-Policy in Nginx

In Nginx, site configuration files are typically found in /etc/nginx/sites-available/ or in /etc/nginx/conf.d
Open your site’s configuration file in a text editor.

Within the server block, include the add_header directive to define the policy. Here’s an example:

add_header Permissions-Policy "geolocation=(), microphone=(), camera=()";

This configuration restricts access to geolocation, microphone, and camera in the browser.

Save the file. Before applying the changes, validate the syntax of your Nginx configuration to ensure there are no syntax errors:

nginx -t

If the syntax check is successful, restart Nginx to implement the changes:

systemctl restart nginx

Permissions-Policy FAQ

Let’s answer some of the most common questions related to this topic.

How often should I review and update my Permissions-Policy?

It’s a good practice to review and update it regularly, more so when adding new features to your website or when security vulnerabilities are discovered. Stay informed about best practices and important changes in browsers.

Can I customize Permissions-Policy for my website?

Yes, you can customize it to fit your website’s specific needs by specifying the correct directives and origins. Make sure to test your configuration to ensure compatibility and security.

Can Permissions-Policy be used to restrict access to all browser features?

While this policy can control access to many browser features and APIs, it does not cover every possible action. Some features may require additional security measures or browser-specific settings.

Does Permissions-Policy affect the performance of my website?

It should not significantly impact website performance. However, restricting access to certain features may affect user experience, particularly if those features are important for your website’s functionality.

Summary

Permissions-Policy is considered a crucial tool for both internet users and developers, and is used to protect our online privacy. It defines rules granting access to sensitive resources like cameras, microphones, and geolocation data, ensuring that access is given only to trusted sources and for legitimate purposes.

Formerly known as Feature Policy, Permissions-Policy has become the modern standard. It’s recommended for compatibility with contemporary browsers.

Scroll to Top