summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-01-19 10:15:12 +0000
committerErik Johnston <erik@matrix.org>2016-01-19 10:15:12 +0000
commit0d241e1114c20e7225d49678f34e9e4e5b3872c9 (patch)
tree2e7f026dac89d9bff73af8460d7084322ce93552 /synapse/rest
parentUpdate _id (diff)
downloadsynapse-0d241e1114c20e7225d49678f34e9e4e5b3872c9.tar.xz
Take a deepcopy of push rules before mutating them
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/client/v1/push_rule.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/synapse/rest/client/v1/push_rule.py b/synapse/rest/client/v1/push_rule.py
index aa861e7033..2272d66dc7 100644
--- a/synapse/rest/client/v1/push_rule.py
+++ b/synapse/rest/client/v1/push_rule.py
@@ -27,6 +27,7 @@ from synapse.push.rulekinds import (
     PRIORITY_CLASS_MAP, PRIORITY_CLASS_INVERSE_MAP
 )
 
+import copy
 import simplejson as json
 
 
@@ -126,7 +127,8 @@ class PushRuleRestServlet(ClientV1RestServlet):
             rule["actions"] = json.loads(rawrule["actions"])
             ruleslist.append(rule)
 
-        ruleslist = baserules.list_with_base_rules(ruleslist)
+        # We're going to be mutating this a lot, so do a deep copy
+        ruleslist = copy.deepcopy(baserules.list_with_base_rules(ruleslist))
 
         rules = {'global': {}, 'device': {}}