Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Block direct sends of m.room.aliases events
Browse files Browse the repository at this point in the history
  • Loading branch information
richvdh committed Jan 29, 2020
1 parent 281551f commit cdcdccd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/6794.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Implement updated authorization rules for aliases events, from [MSC2260](https://github.com/matrix-org/matrix-doc/pull/2260).
12 changes: 12 additions & 0 deletions synapse/rest/client/v1/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ async def on_PUT(self, request, room_id, event_type, state_key, txn_id=None):

content = parse_json_object_from_request(request)

if event_type == EventTypes.Aliases:
# MSC2260
raise SynapseError(
400, "Cannot send m.room.aliases events via /rooms/{room_id}/state"
)

event_dict = {
"type": event_type,
"content": content,
Expand Down Expand Up @@ -231,6 +237,12 @@ async def on_POST(self, request, room_id, event_type, txn_id=None):
requester = await self.auth.get_user_by_req(request, allow_guest=True)
content = parse_json_object_from_request(request)

if event_type == EventTypes.Aliases:
# MSC2260
raise SynapseError(
400, "Cannot send m.room.aliases events via /rooms/{room_id}/send"
)

event_dict = {
"type": event_type,
"content": content,
Expand Down

0 comments on commit cdcdccd

Please sign in to comment.