Skip to content

Commit

Permalink
disable owasp experimental permisisons policy
Browse files Browse the repository at this point in the history
  • Loading branch information
vejja committed May 31, 2024
1 parent 705ac53 commit 4313aa0
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default defineNuxtConfig({
By default, Nuxt Security will set following value for this header.

```http
Permissions-Policy: accelerometer=(), ambient-light-sensor=(), autoplay=(), battery=(), camera=(), display-capture=(), document-domain=(), encrypted-media=(), fullscreen=(), gamepad=(), geolocation=(), gyroscope=(), layout-animations=(self), legacy-image-formats=(self), magnetometer=(), microphone=(), midi=(), oversized-images=(self), payment=(), picture-in-picture=(), publickey-credentials-get=(), speaker-selection=(), sync-xhr=(self), unoptimized-images=(self), unsized-media=(self), usb=(), screen-wake-lock=(), web-share=(), xr-spatial-tracking=();
Permissions-Policy: accelerometer=(), autoplay=(), camera=(), display-capture=(), encrypted-media=(), fullscreen=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=(), picture-in-picture=(), publickey-credentials-get=(), screen-wake-lock=(), sync-xhr=(self), usb=(), web-share=(), xr-spatial-tracking=()
```

## Available values
Expand Down
22 changes: 21 additions & 1 deletion src/defaultConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,32 +39,52 @@ export const defaultSecurityConfig = (serverlUrl: string): ModuleOptions => ({
xXSSProtection: '0',
permissionsPolicy: {
accelerometer: [],
/* Disable OWASP Experimental values
'ambient-light-sensor':[],
*/
autoplay:[],
/* Disable OWASP Experimental values
battery:[],
*/
camera:[],
'display-capture':[],
/* Disable OWASP Experimental values
'document-domain':[],
*/
'encrypted-media':[],
fullscreen:[],
/* Disable OWASP Experimental values
gamepad:[],
*/
geolocation:[],
gyroscope:[],
/* Disable OWASP Experimental values
'layout-animations':['self'],
*/
/* Disable OWASP Experimental values
'legacy-image-formats':['self'],
*/
magnetometer:[],
microphone:[],
midi:[],
/* Disable OWASP Experimental values
'oversized-images':['self'],
*/
payment:[],
'picture-in-picture':[],
'publickey-credentials-get':[],
'screen-wake-lock':[],
/* Disable OWASP Experimental values
'speaker-selection':[],
*/
'sync-xhr':['self'],
/* Disable OWASP Experimental values
'unoptimized-images':['self'],
*/
/* Disable OWASP Experimental values
'unsized-media':['self'],
*/
usb:[],
'screen-wake-lock':[],
'web-share':[],
'xr-spatial-tracking':[]
}
Expand Down
2 changes: 1 addition & 1 deletion test/headers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe('[nuxt-security] Headers', async () => {
const ppHeaderValue = headers.get('permissions-policy')

expect(ppHeaderValue).toBeTruthy()
expect(ppHeaderValue).toBe('accelerometer=(), ambient-light-sensor=(), autoplay=(), battery=(), camera=(), display-capture=(), document-domain=(), encrypted-media=(), fullscreen=(), gamepad=(), geolocation=(), gyroscope=(), layout-animations=(self), legacy-image-formats=(self), magnetometer=(), microphone=(), midi=(), oversized-images=(self), payment=(), picture-in-picture=(), publickey-credentials-get=(), speaker-selection=(), sync-xhr=(self), unoptimized-images=(self), unsized-media=(self), usb=(), screen-wake-lock=(), web-share=(), xr-spatial-tracking=()')
expect(ppHeaderValue).toBe('accelerometer=(), autoplay=(), camera=(), display-capture=(), encrypted-media=(), fullscreen=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=(), picture-in-picture=(), publickey-credentials-get=(), screen-wake-lock=(), sync-xhr=(self), usb=(), web-share=(), xr-spatial-tracking=()')
})

it('has `referrer-policy` header set with correct default value', async () => {
Expand Down
Loading

0 comments on commit 4313aa0

Please sign in to comment.