@@ -445,22 +445,22 @@ async def process_remote_join(
445445 if room_version .identifier != room_version_id :
446446 raise SynapseError (400 , "Room version mismatch" )
447447
448- # we should have all of the auth events in the chain.
449- for e in itertools .chain (auth_events , state , [event ]):
450- for e_id in e .auth_event_ids ():
451- if e_id not in event_map :
452- logger .info (
453- "Auth chain incomplete: %s refers to missing event %s" , e , e_id
454- )
455- raise SynapseError (400 , "Auth chain incomplete" )
456-
457448 # filter out any events we have already seen
458449 seen_remotes = await self ._store .have_seen_events (room_id , event_map .keys ())
459450 for s in seen_remotes :
460451 event_map .pop (s , None )
461452
462453 # persist the auth chain and state events.
454+ #
463455 # any invalid events here will be marked as rejected, and we'll carry on.
456+ #
457+ # any events whose auth events are missing (ie, not in the send_join response,
458+ # and not already in our db) will just be ignored. This is correct behaviour,
459+ # because the reason that auth_events are missing might be due to us being
460+ # unable to validate their signatures. The fact that we can't validate their
461+ # signatures right now doesn't mean that we will *never* be able to, so it
462+ # is premature to reject them.
463+ #
464464 await self ._auth_and_persist_outliers (room_id , event_map .values ())
465465
466466 # and now persist the join event itself.
@@ -1304,14 +1304,14 @@ def prep(event: EventBase) -> Optional[Tuple[EventBase, EventContext]]:
13041304 for auth_event_id in event .auth_event_ids ():
13051305 ae = persisted_events .get (auth_event_id )
13061306 if not ae :
1307+ # the fact we can't find the auth event doesn't mean it doesn't
1308+ # exist, which means it is premature to reject `event`. Instead we
1309+ # just ignore it for now.
13071310 logger .warning (
1308- "Event %s relies on auth_event %s, which could not be found. " ,
1311+ "Dropping event %s, which relies on auth_event %s, which could not be found" ,
13091312 event ,
13101313 auth_event_id ,
13111314 )
1312- # the fact we can't find the auth event doesn't mean it doesn't
1313- # exist, which means it is premature to reject `event`. Instead we
1314- # just ignore it for now.
13151315 return None
13161316 auth .append (ae )
13171317
0 commit comments