diff options
author | Erik Johnston <erik@matrix.org> | 2016-01-19 10:15:12 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-01-19 10:15:12 +0000 |
commit | 0d241e1114c20e7225d49678f34e9e4e5b3872c9 (patch) | |
tree | 2e7f026dac89d9bff73af8460d7084322ce93552 /synapse | |
parent | Update _id (diff) | |
download | synapse-0d241e1114c20e7225d49678f34e9e4e5b3872c9.tar.xz |
Take a deepcopy of push rules before mutating them
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/rest/client/v1/push_rule.py | 4 |
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': {}} |