Skip to content

Commit d51da8c

Browse files
committed
Don't add nonce to CSP if unsafe-inline is on
Browsers ignore unsafe-inline if a nonce is sent
1 parent 91101c8 commit d51da8c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

app.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,9 @@ if (config.csp.enable) {
171171
)
172172
}
173173
}
174-
directives.scriptSrc.push(getCspNonce)
174+
if (directives.scriptSrc.indexOf('\'unsafe-inline\'') === -1) {
175+
directives.scriptSrc.push(getCspNonce)
176+
}
175177
directives.connectSrc.push(getCspWebSocketUrl)
176178
if (config.csp.upgradeInsecureRequests === 'auto') {
177179
directives.upgradeInsecureRequests = config.usessl === 'true'

0 commit comments

Comments
 (0)