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

Commit

Permalink
Ensure that we reject events which use rejected events for auth (#10956)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
richvdh authored Oct 5, 2021
1 parent 787af4a commit 3a5b0cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/10956.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a long-standing bug which meant that events received over federation were sometimes incorrectly accepted into the room state.
6 changes: 6 additions & 0 deletions synapse/event_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ def check_auth_rules_for_event(
"which is in room %s"
% (event.event_id, room_id, auth_event.event_id, auth_event.room_id),
)
if auth_event.rejected_reason:
raise AuthError(
403,
"During auth for event %s: found rejected event %s in the state"
% (event.event_id, auth_event.event_id),
)

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

0 comments on commit 3a5b0cb

Please sign in to comment.