summary refs log tree commit diff
path: root/synapse/storage/databases/main/stats.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2020-09-22 19:39:29 +0100
committerAndrew Morgan <andrew@amorgan.xyz>2020-09-22 19:39:29 +0100
commit4325be1a52b9054a2c1096dcdb29ee79d9ad4ead (patch)
tree0b442f3f57fb2dfeb1ce5e5c5b35f39ac92ddfd3 /synapse/storage/databases/main/stats.py
parentFixed a bug with reactivating users with the admin API (#8362) (diff)
downloadsynapse-4325be1a52b9054a2c1096dcdb29ee79d9ad4ead.tar.xz
Fix missing null character check on guest_access room state
When updating room_stats_state, we try to check for null bytes slipping
in to the
content for state events. It turns out we had added guest_access as a
field to
room_stats_state without including it in the null byte check.

Lo and behold, a null byte in a m.room.guest_access event then breaks
room_stats_state
updates.

This PR adds the check for guest_access. A further PR will improve this
function so that this hopefully does not happen again in future.
Diffstat (limited to 'synapse/storage/databases/main/stats.py')
-rw-r--r--synapse/storage/databases/main/stats.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/synapse/storage/databases/main/stats.py b/synapse/storage/databases/main/stats.py
index d7816a8606..5beb302be3 100644
--- a/synapse/storage/databases/main/stats.py
+++ b/synapse/storage/databases/main/stats.py
@@ -210,6 +210,7 @@ class StatsStore(StateDeltasStore):
         * topic
         * avatar
         * canonical_alias
+        * guest_access
 
         A is_federatable key can also be included with a boolean value.
 
@@ -234,6 +235,7 @@ class StatsStore(StateDeltasStore):
             "topic",
             "avatar",
             "canonical_alias",
+            "guest_access",
         ):
             field = fields.get(col, sentinel)
             if field is not sentinel and (not isinstance(field, str) or "\0" in field):