|
1 | 1 | # frozen_string_literal: true |
2 | 2 |
|
3 | 3 | # Be sure to restart your server when you modify this file. |
| 4 | +# |
| 5 | +# Password Pusher is a form-based app: copy-to-clipboard is the main browser |
| 6 | +# capability we rely on. Everything else is denied by default. |
| 7 | +# |
| 8 | +# Rails emits Feature-Policy (legacy). Scanners expect Permissions-Policy |
| 9 | +# (modern syntax), so both are configured here. |
4 | 10 |
|
5 | | -# Define an application-wide HTTP permissions policy. For further |
6 | | -# information see: https://developers.google.com/web/updates/2018/06/feature-policy |
| 11 | +Rails.application.configure do |
| 12 | + config.permissions_policy do |policy| |
| 13 | + policy.accelerometer :none |
| 14 | + policy.ambient_light_sensor :none |
| 15 | + policy.autoplay :none |
| 16 | + policy.camera :none |
| 17 | + policy.display_capture :none |
| 18 | + policy.encrypted_media :none |
| 19 | + policy.fullscreen :none |
| 20 | + policy.geolocation :none |
| 21 | + policy.gyroscope :none |
| 22 | + policy.hid :none |
| 23 | + policy.idle_detection :none |
| 24 | + policy.magnetometer :none |
| 25 | + policy.microphone :none |
| 26 | + policy.midi :none |
| 27 | + policy.payment :none |
| 28 | + policy.picture_in_picture :none |
| 29 | + policy.screen_wake_lock :none |
| 30 | + policy.serial :none |
| 31 | + policy.sync_xhr :none |
| 32 | + policy.usb :none |
| 33 | + policy.web_share :none |
| 34 | + end |
7 | 35 |
|
8 | | -# Rails.application.config.permissions_policy do |policy| |
9 | | -# policy.camera :none |
10 | | -# policy.gyroscope :none |
11 | | -# policy.microphone :none |
12 | | -# policy.usb :none |
13 | | -# policy.fullscreen :self |
14 | | -# policy.payment :self, "https://secure.example.com" |
15 | | -# end |
| 36 | + config.action_dispatch.default_headers["Permissions-Policy"] = [ |
| 37 | + "accelerometer=()", |
| 38 | + "autoplay=()", |
| 39 | + "camera=()", |
| 40 | + "clipboard-write=(self)", |
| 41 | + "display-capture=()", |
| 42 | + "encrypted-media=()", |
| 43 | + "fullscreen=()", |
| 44 | + "geolocation=()", |
| 45 | + "gyroscope=()", |
| 46 | + "hid=()", |
| 47 | + "idle-detection=()", |
| 48 | + "magnetometer=()", |
| 49 | + "microphone=()", |
| 50 | + "midi=()", |
| 51 | + "payment=()", |
| 52 | + "picture-in-picture=()", |
| 53 | + "publickey-credentials-get=()", |
| 54 | + "screen-wake-lock=()", |
| 55 | + "serial=()", |
| 56 | + "sync-xhr=()", |
| 57 | + "usb=()", |
| 58 | + "web-share=()", |
| 59 | + "xr-spatial-tracking=()" |
| 60 | + ].join(", ") |
| 61 | +end |
0 commit comments