summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2023-02-09 10:56:02 -0500
committerGitHub <noreply@github.com>2023-02-09 15:56:02 +0000
commit8a6e0434889ea94893119775b6f56904cbc575c2 (patch)
tree20df6f76f427b1c3310177b83b86f915b0dc038c /synapse/handlers
parentAdd final type hint to synapse.server. (#15035) (diff)
downloadsynapse-8a6e0434889ea94893119775b6f56904cbc575c2.tar.xz
Avoid mutating cached room aliases. (#15038)
This might cause incorrect data in other callers which
are not expecting the canonical alias to be added into
the response.
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/directory.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/synapse/handlers/directory.py b/synapse/handlers/directory.py
index 2ea52257cb..d31b0fbb17 100644
--- a/synapse/handlers/directory.py
+++ b/synapse/handlers/directory.py
@@ -485,7 +485,8 @@ class DirectoryHandler:
                 )
             )
             if canonical_alias:
-                room_aliases.append(canonical_alias)
+                # Ensure we do not mutate room_aliases.
+                room_aliases = room_aliases + [canonical_alias]
 
             if not self.config.roomdirectory.is_publishing_room_allowed(
                 user_id, room_id, room_aliases