aboutsummaryrefslogtreecommitdiff
path: root/common/policy.js
diff options
context:
space:
mode:
Diffstat (limited to 'common/policy.js')
-rw-r--r--common/policy.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/common/policy.js b/common/policy.js
index 47b2d1d..e14d8cd 100644
--- a/common/policy.js
+++ b/common/policy.js
@@ -52,9 +52,13 @@
function make_csp(nonce)
{
const rule = nonce ? `nonce-${nonce}` : "none";
- const csp_dict = {"prefetch-src": "none", "script-src-attr": "none"};
- Object.assign(csp_dict, {"script-src": rule, "script-src-elem": rule});
- return Object.entries(csp_dict).map(([a, b]) => `${a} '${b}';`).join(" ");
+ const csp_list = [
+ ["prefetch-src", "none"],
+ ["script-src-attr", "none"],
+ ["script-src", rule],
+ ["script-src-elem", rule]
+ ];
+ return csp_list.map(([a, b]) => `${a} '${b}';`).join(" ");
}
function decide_policy(patterns_tree, url, default_allow, secret)