summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/policy.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/common/policy.js b/common/policy.js
index 0ac71d6..7ab9b5d 100644
--- a/common/policy.js
+++ b/common/policy.js
@@ -70,10 +70,15 @@ function decide_policy(patterns_tree, url, default_allow, secret)
}
if (payloads !== undefined) {
+ /*
+ * mapping will be either the actual mapping identifier or "~allow" if
+ * we matched a simple script block/allow rule.
+ */
policy.mapping = Object.keys(payloads).sort()[0];
const payload = payloads[policy.mapping];
- if (payload.allow !== undefined) {
- policy.allow = payload.allow;
+ if (policy.mapping === "~allow") {
+ /* Convert 0/1 back to false/true. */
+ policy.allow = !!payload;
} else /* if (payload.identifier) */ {
policy.allow = false;
policy.payload = payload;