Security rules

NGB062: Permissive Permissions-Policy

Reports Permissions-Policy (and legacy Feature-Policy) response headers that grant powerful browser features — camera, microphone, geolocation, payment, display capture, USB / serial / HID / Bluetooth, clipboard read, WebAuthn / FedCM credentials — to every origin with the * allowlist.

Property Value
Rule ID NGB062
Category Security configuration
Default severity low
CWE CWE-250, CWE-1021
Built-in presets recommended: warn, strict: error

Confidence is reported per finding (high, medium, low) and is independent of severity. See Reading findings.

What it checks

Reports Permissions-Policy (and legacy Feature-Policy) response headers that grant powerful browser features — camera, microphone, geolocation, payment, display capture, USB / serial / HID / Bluetooth, clipboard read, WebAuthn / FedCM credentials — to every origin with the * allowlist. Headers are read from hosting configs (firebase.json, vercel.json, staticwebapp.config.json, _headers) and from constant setHeader() / set() / header() calls in server code. Iframe allow attributes are covered by NGB010.

Why it matters

Permissions-Policy is the page's ceiling for which origins may ever use a feature. With camera=* any cross-origin frame the page embeds — an ad, a widget, user-supplied embed content — can be granted the camera with an allow attribute, and a single injected iframe is enough to prompt for, or (if the user already granted your origin) silently use, the device. The default allowlist for these features is self; a wildcard only removes protection.

Detection behavior and supported patterns

  • Permissions-Policy: camera=*, geolocation=(*) and Feature-Policy: camera * in hosting configs / _headers
  • res.setHeader('Permissions-Policy', 'payment=*') (also set, header, append) with a constant value
  • Medium severity for device, payment, capture and credential features; low for sensors, MIDI, wake lock, local fonts and clipboard write

Example

TypeScript
{ "key": "Permissions-Policy", "value": "camera=*, microphone=*, geolocation=*" }

Safer alternative

TypeScript
{ "key": "Permissions-Policy", "value": "camera=(self \"https://video.example.com\"), microphone=(), geolocation=()" }

Remediation

Grant powerful features only to the origins that need them — camera=(self "https://video.example.com") — or disable unused ones completely (camera=(), microphone=(), geolocation=()).

False-positive considerations

  • Applications that deliberately delegate a feature to arbitrary third-party embeds (e.g. a video-conferencing marketplace) are reported; prefer listing the partner origins instead of *.

Known limitations

  • Headers added by a CDN, reverse proxy or framework middleware outside the repository are not visible.
  • A missing Permissions-Policy header is not reported (the browser defaults are restrictive).

References

Run it

Shell
ngbastion explain NGB062