LEARNING OBJECTIVES ⌵
- Master the complete taxonomy of standardized Permissions Policy feature identifiers.
- Understand the security and privacy attack vectors associated with each capability (side-channel tracking, eavesdropping, UI freezing).
- Apply restrictive policies to high-risk hardware interfaces (
usb,serial,bluetooth,hid). - Construct an enterprise-grade, zero-trust Permissions Policy header matrix covering all major feature groups.
📖 The Mental Model & Story (Intuitive Foundation)
Think of a smartphone operating system's capability manifest. When you install an app, the OS doesn't just ask "Do you trust this app?". Instead, it presents an itemized permission sheet:
- 📷 Camera
- 🎙️ Microphone
- 📍 Precise Location
- 💳 NFC / Apple Pay
- 🔄 Gyroscope & Accelerometer
- 🔌 USB Host Connection
If a simple calculator app asks for permission to access your USB port, your microphone, and your gyroscope, alarm bells ring immediately. Why does a calculator need to measure angular velocity or listen to ambient room noise?
+-------------------------------------------------------------------------------+
| THE BROWSER CAPABILITY SURFACE |
| |
| [ Media & Capture ] [ Device Sensors ] [ Hardware Peripherals ] |
| - camera - accelerometer - usb |
| - microphone - gyroscope - serial |
| - display-capture - magnetometer - bluetooth |
| - picture-in-picture - ambient-light-sensor - hid |
| |
| [ Web Platform APIs ] [ User Interaction ] [ Legacy / Performance ] |
| - payment - fullscreen - sync-xhr |
| - web-share - clipboard-read - autoplay |
| - identity-credentials - clipboard-write - execution-while-out- |
| of-viewport |
+-------------------------------------------------------------------------------+
The web browser has evolved into a full-fledged operating system capable of communicating with industrial microcontrollers via Web Serial, processing biometric credit card transactions via Web Payments, and tracking millidegree device rotations via motion sensors.
Without a Permissions Policy, all of these capabilities are active in the browser engine, waiting for any executing script to call them. By curating a strict feature policy, you turn off unused hardware controllers at the kernel layer of the browser engine.
Technical Deep Dive & Specifications
Comprehensive Taxonomy of Policy-Controlled Features
The W3C maintains a standardized registry of policy-controlled features. They are categorized into five core functional domains:
1. Audio, Video & Screen Capture
| Feature Identifier | Description | Privacy / Security Threat |
|---|---|---|
camera |
Controls navigator.mediaDevices.getUserMedia({ video: true }) |
Unauthorized video recording, physical facial tracking, environment surveillance. |
microphone |
Controls navigator.mediaDevices.getUserMedia({ audio: true }) |
Ambient audio eavesdropping, acoustic side-channel attacks. |
display-capture |
Controls navigator.mediaDevices.getDisplayMedia() (Screen Sharing) |
Accidental or malicious recording of desktop windows, sensitive tabs, passwords. |
autoplay |
Controls automatic playback of <audio> and <video> without user gesture |
Intrusive advertising, bandwidth exhaustion, battery drain. |
picture-in-picture |
Controls videoElement.requestPictureInPicture() |
Floating video spoofing or user distraction. |
encrypted-media |
Controls Encrypted Media Extensions (navigator.requestMediaKeySystemAccess) |
DRM key exchange and proprietary CDM execution. |
2. Location & Identity
| Feature Identifier | Description | Privacy / Security Threat |
|---|---|---|
geolocation |
Controls navigator.geolocation.getCurrentPosition() |
Precise physical tracking of user whereabouts and movement patterns. |
identity-credentials-get |
Controls Federated Credential Management API (FedCM) | Unintended third-party single sign-on token leakage. |
otp-credentials |
Controls WebOTP API (navigator.credentials.get({ otp: ... })) |
Interception of SMS two-factor verification codes. |
3. Motion & Environmental Sensors
| Feature Identifier | Description | Privacy / Security Threat |
|---|---|---|
accelerometer |
Measures acceleration forces along x, y, z axes | Keystroke inference (acoustic/vibrational analysis of passwords typed on keyboards). |
gyroscope |
Measures rate of rotation around device axes | Device fingerprinting, user gait tracking, PIN recovery side-channels. |
magnetometer |
Measures ambient magnetic fields (compass) | Room-level physical location fingerprinting. |
ambient-light-sensor |
Measures ambient room lux lighting | Cross-device tracking, sniffing browsing habits based on screen reflection. |
4. Hardware & Peripheral Interfacing
| Feature Identifier | Description | Privacy / Security Threat |
|---|---|---|
usb |
Controls WebUSB API (navigator.usb.requestDevice()) |
Direct communication with connected USB hardware (YubiKeys, flash drives, firmware flashing). |
serial |
Controls Web Serial API (navigator.serial.requestPort()) |
Direct serial communication with Arduino, microcontrollers, medical devices. |
bluetooth |
Controls Web Bluetooth API (navigator.bluetooth.requestDevice()) |
Communication with IoT devices, smart beacons, medical monitors. |
hid |
Controls WebHID API (navigator.hid.requestDevice()) |
Direct raw input interception from human interface devices (specialty gaming keyboards, gamepads). |
5. Web Platform & Execution Governors
| Feature Identifier | Description | Privacy / Security Threat |
|---|---|---|
payment |
Controls Payment Request API (new PaymentRequest(...)) |
Clickjacking payment flows, triggering unauthorized payment modals. |
fullscreen |
Controls element.requestFullscreen() |
Phishing attacks where an iframe creates a full-screen spoofed OS login dialog. |
web-share |
Controls navigator.share() |
Triggering unwanted native OS share dialogs. |
clipboard-read |
Controls navigator.clipboard.read() |
Stealing sensitive text, passwords, or crypto addresses from user clipboard. |
clipboard-write |
Controls navigator.clipboard.write() |
Silent clipboard hijacking (replacing copied crypto addresses). |
sync-xhr |
Controls synchronous XMLHttpRequest (xhr.open('GET', url, false)) |
Freezes the browser UI thread completely; major performance and UX hazard. |
💻 Interactive Code Playground
Starter Code
Save the following file as feature-matrix-test.html. It renders an interactive dashboard demonstrating runtime feature detection and invocation for multiple core features.
Line-by-Line Code Breakdown
- Lines 102–112: Defines a comprehensive array covering all major feature categories (
Media,Location,Hardware,Platform,Interaction,Sensor). - Lines 125–130: Uses
document.permissionsPolicy.allowsFeature(name)to inspect whether the document is permitted to access that specific hardware controller. - Lines 149–160: Standardized test execution harness. When a blocked feature is tested, the browser engine throws a
NotAllowedErrororSecurityErrorwithout showing a user prompt.
Expected Browser Render Output
Core Feature Policy Governance Matrix
-------------------------------------------------------------------------------------
CATEGORY FEATURE NAME POLICY STATUS TEST EXECUTION
Media camera [ BLOCKED ] [ Test API ]
Media microphone [ BLOCKED ] [ Test API ]
Media display-capture [ BLOCKED ] [ Test API ]
Location geolocation [ ALLOWED ] [ Test API ]
Hardware usb [ BLOCKED ] [ Test API ]
Hardware serial [ BLOCKED ] [ Test API ]
Platform payment [ ALLOWED ] [ Test API ]
Interaction fullscreen [ ALLOWED ] [ Test API ]
Sensor accelerometer [ BLOCKED ] [ Test API ]
Activity Console:
[10:35:10] Invoking API for 'usb'...
[10:35:10] DENIED/ERROR on 'usb': SecurityError - Access to the feature "usb" is disallowed by permissions policy.🏋️ Hands-On Exercise
🎯 The Challenge: Build a Production Enterprise Security Policy Matrix
Scenario: You are securing a healthcare portal where patients review medical records and conduct video consultations with licensed physicians.
Policy Requirements:
- Camera & Microphone: Allowed only for
selfand the telemedicine partner ("https://video.telehealth-provider.com"). - Geolocation: Allowed only for
selfto locate nearby emergency clinics. - Display Capture: Allowed only for
self(physicians sharing test results). - Fullscreen: Allowed for
*(video consultations full-screen mode). - Hardware & Sensors:
usb,serial,bluetooth,hid,accelerometer,gyroscope,magnetometer, andambient-light-sensormust be completely disabled (()). - Payment & Legacy:
paymentallowed for(self "https://pay.healthcorp.com"), andsync-xhrmust be completely disabled (()).
🏁 Starter Code Sandbox
⚠️ Common Pitfalls
- Ignoring Motion Sensors on Sensitive Input Pages: Failing to disable
accelerometerandgyroscopeon login or checkout pages leaves users vulnerable to mobile keystroke inference attacks via untrusted third-party ad scripts. - Forgetting
display-captureGovernance: Developers often restrictcamerabut forgetdisplay-capture. An attacker who gains script execution could prompt the user with a deceptive screen-share dialog to record confidential financial data. - Using Legacy Names: Using deprecated names like
speaker,vibrate, orvr. Always consult the current W3C Permissions Policy feature registry for standardized identifiers.
💡 Pro Tips
- Block
sync-xhrUniversally: Addsync-xhr=()to every production web application. Synchronous XMLHttpRequest is an anti-pattern that locks the main thread and hurts Core Web Vitals (INP/FID). - Employ Sensor Batching Protections: If your web application genuinely requires accelerometer access (such as a 3D medical visualizer), restrict it strictly to
(self)and sample data at lower frequencies to mitigate acoustic side-channel leaks. - Pair Permissions Policy with WebAuthn: Never rely on
otp-credentialsalone; use modern WebAuthn Passkeys (publickey-credentials-get) for phishing-resistant multi-factor authentication.
📌 Key Takeaways
- Policy-controlled features govern Media Capture, Location/Identity, Sensors, Hardware Peripherals, and Platform APIs.
- Disabling unused hardware interfaces (
usb=(),serial=(),bluetooth=()) prevents malicious hardware exploitation and driver tampering. - Disabling motion sensors (
accelerometer=(),gyroscope=()) prevents side-channel acoustic eavesdropping and keystroke inference. sync-xhr=()disables legacy synchronous XHR calls, preventing thread lockups and boosting site performance.- A hardened enterprise Permissions Policy disables all features by default, selectively whitelisting only those essential for business functionality.
- --