From b35c6483d513dcc340961532f53ccaeb35f94f3f Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Mon, 30 Jun 2025 04:45:23 -0600 Subject: [PATCH] Skip processing policy server events through policy server (#18605) Co-authored-by: Andrew Morgan --- changelog.d/18605.bugfix | 1 + synapse/handlers/room_policy.py | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 changelog.d/18605.bugfix diff --git a/changelog.d/18605.bugfix b/changelog.d/18605.bugfix new file mode 100644 index 0000000000..516f09e502 --- /dev/null +++ b/changelog.d/18605.bugfix @@ -0,0 +1 @@ +Ensure policy servers are not asked to scan policy server change events, allowing rooms to disable the use of a policy server while the policy server is down. diff --git a/synapse/handlers/room_policy.py b/synapse/handlers/room_policy.py index dcfebb128c..170c477d6f 100644 --- a/synapse/handlers/room_policy.py +++ b/synapse/handlers/room_policy.py @@ -54,6 +54,9 @@ class RoomPolicyHandler: Returns: bool: True if the event is allowed in the room, False otherwise. """ + if event.type == "org.matrix.msc4284.policy" and event.state_key is not None: + return True # always allow policy server change events + policy_event = await self._storage_controllers.state.get_current_state_event( event.room_id, "org.matrix.msc4284.policy", "" )