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

Commit 3a5b0cb

Browse files
authored
Ensure that we reject events which use rejected events for auth (#10956)
When we consider whether to accept events, we should not accept those which depend on rejected events for their auth events. This (together with earlier changes such as #10771 and #10896) forms a partial fix to #9595. There still remain code paths where we do not check the `auth_events` at all.
1 parent 787af4a commit 3a5b0cb

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

changelog.d/10956.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a long-standing bug which meant that events received over federation were sometimes incorrectly accepted into the room state.

synapse/event_auth.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ def check_auth_rules_for_event(
155155
"which is in room %s"
156156
% (event.event_id, room_id, auth_event.event_id, auth_event.room_id),
157157
)
158+
if auth_event.rejected_reason:
159+
raise AuthError(
160+
403,
161+
"During auth for event %s: found rejected event %s in the state"
162+
% (event.event_id, auth_event.event_id),
163+
)
158164

159165
# Implementation of https://matrix.org/docs/spec/rooms/v1#authorization-rules
160166
#

0 commit comments

Comments
 (0)