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

Commit b73cbb8

Browse files
authored
Avoid putting rejected events in room state (#13723)
Signed-off-by: Sean Quah <seanq@matrix.org>
1 parent 6986bcb commit b73cbb8

File tree

3 files changed

+415
-0
lines changed

3 files changed

+415
-0
lines changed

changelog.d/13723.bugfix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a long-standing bug where previously rejected events could end up in room state because they pass auth checks given the current state of the room.

synapse/state/v2.py

+15
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,21 @@ async def _iterative_auth_checks(
577577
if ev.rejected_reason is None:
578578
auth_events[key] = event_map[ev_id]
579579

580+
if event.rejected_reason is not None:
581+
# Do not admit previously rejected events into state.
582+
# TODO: This isn't spec compliant. Events that were previously rejected due
583+
# to failing auth checks at their state, but pass auth checks during
584+
# state resolution should be accepted. Synapse does not handle the
585+
# change of rejection status well, so we preserve the previous
586+
# rejection status for now.
587+
#
588+
# Note that events rejected for non-state reasons, such as having the
589+
# wrong auth events, should remain rejected.
590+
#
591+
# https://spec.matrix.org/v1.2/rooms/v9/#rejected-events
592+
# https://github.com/matrix-org/synapse/issues/13797
593+
continue
594+
580595
try:
581596
event_auth.check_state_dependent_auth_rules(
582597
event,

0 commit comments

Comments
 (0)