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

Commit 1821471

Browse files
Check third party rules before persisting knocks over federation (#10212)
An accidental mis-ordering of operations during #6739 technically allowed an incoming knock event over federation in before checking it against any configured Third Party Access Rules modules. This PR corrects that by performing the TPAR check *before* persisting the event.
1 parent 107c060 commit 1821471

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

changelog.d/10212.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Implement "room knocking" as per [MSC2403](https://github.com/matrix-org/matrix-doc/pull/2403). Contributed by Sorunome and anoa.

synapse/handlers/federation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,8 +2086,6 @@ async def on_send_knock_request(
20862086

20872087
context = await self.state_handler.compute_event_context(event)
20882088

2089-
await self._auth_and_persist_event(origin, event, context)
2090-
20912089
event_allowed = await self.third_party_event_rules.check_event_allowed(
20922090
event, context
20932091
)
@@ -2097,6 +2095,8 @@ async def on_send_knock_request(
20972095
403, "This event is not allowed in this context", Codes.FORBIDDEN
20982096
)
20992097

2098+
await self._auth_and_persist_event(origin, event, context)
2099+
21002100
return context
21012101

21022102
async def get_state_for_pdu(self, room_id: str, event_id: str) -> List[EventBase]:

0 commit comments

Comments
 (0)