Skip to content

Commit

Permalink
Implement Permissions-Policy header (digitalocean#282)
Browse files Browse the repository at this point in the history
* Implement Permissions-Policy header

* Bump copyright year

Co-authored-by: Matt (IPv4) Cowley <[email protected]>
  • Loading branch information
WalshyDev and MattIPv4 authored Jun 25, 2021
1 parent 3e99dc2 commit fee8fb4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/nginxconfig/generators/conf/security.conf.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2020 DigitalOcean
Copyright 2021 DigitalOcean
This code is licensed under the MIT License.
You may obtain a copy of the License at
Expand Down Expand Up @@ -37,6 +37,9 @@ export default (domains, global) => {
if (global.security.contentSecurityPolicy.computed)
config.push(['add_header Content-Security-Policy', `"${global.security.contentSecurityPolicy.computed}" always`]);

if (global.security.permissionsPolicy.computed)
config.push(['add_header Permissions-Policy', `"${global.security.permissionsPolicy.computed}" always`]);

// Every domain has HSTS enabled, and they all have same hstsSubdomains/hstsPreload settings
if (commonHsts(domains)) {
const commonHSTSSubdomains = domains.length && domains[0].https.hstsSubdomains.computed;
Expand Down
21 changes: 21 additions & 0 deletions src/nginxconfig/templates/global_sections/security.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,23 @@ THE SOFTWARE.
</div>
</div>

<div class="field is-horizontal">
<div class="field-label">
<label class="label">Permissions-Policy</label>
</div>
<div class="field-body">
<div class="field">
<div :class="`control${permissionsPolicyChanged ? ' is-changed' : ''}`">
<input v-model="permissionsPolicy"
class="input"
type="text"
:placeholder="$props.data.permissionsPolicy.default"
/>
</div>
</div>
</div>
</div>

<div class="field is-horizontal">
<div class="field-label">
<label class="label">server_tokens</label>
Expand Down Expand Up @@ -164,6 +181,10 @@ THE SOFTWARE.
default: 'default-src \'self\' http: https: data: blob: \'unsafe-inline\'; frame-ancestors \'self\';',
enabled: true,
},
permissionsPolicy: {
default: 'interest-cohort=()',
enabled: true,
},
serverTokens: {
default: false,
enabled: true,
Expand Down

0 comments on commit fee8fb4

Please sign in to comment.