Skip to content

Commit 7838731

Browse files
committed
Sanitizing out from the CSP policies in production
Resolves #54
1 parent 95c333e commit 7838731

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,17 @@ module.exports = (api, options) => {
7878
jsonContent.description = packageJson.description
7979
}
8080

81+
jsonContent.content_security_policy =
82+
jsonContent.content_security_policy || "script-src 'self' 'unsafe-eval'; object-src 'self'"
83+
8184
// If building for production (going to web store) abort early.
8285
// The browser extension store will hash your signing key and apply CSP policies.
8386
if (isProduction) {
87+
jsonContent.content_security_policy = jsonContent.content_security_policy.replace(/'unsafe-eval'/, '')
88+
8489
return getManifestJsonString(pluginOptions, jsonContent)
8590
}
8691

87-
jsonContent.content_security_policy =
88-
jsonContent.content_security_policy || "script-src 'self' 'unsafe-eval'; object-src 'self'"
89-
9092
if (hasKeyFile) {
9193
try {
9294
jsonContent.key = await hashKey(keyFile)

0 commit comments

Comments
 (0)