pull up event.sender assertion

This commit is contained in:
Richard van der Hoff 2020-10-05 19:00:50 +01:00
parent 2ee302d016
commit fd0282201e
2 changed files with 5 additions and 4 deletions

View File

@ -664,10 +664,6 @@ class EventCreationHandler:
500, "Tried to send member event through non-member codepath"
)
user = UserID.from_string(event.sender)
assert self.hs.is_mine(user), "User must be our own: %s" % (user,)
ev = await self.handle_new_client_event(
requester=requester,
event=event,
@ -748,6 +744,10 @@ class EventCreationHandler:
requester, event_dict, token_id=requester.access_token_id, txn_id=txn_id
)
assert self.hs.is_mine_id(event.sender), "User must be our own: %s" % (
event.sender,
)
spam_error = self.spam_checker.check_event_for_spam(event)
if spam_error:
if not isinstance(spam_error, str):

View File

@ -185,6 +185,7 @@ class RoomCreationHandler(BaseHandler):
ShadowBanError if the requester is shadow-banned.
"""
user_id = requester.user.to_string()
assert self.hs.is_mine_id(user_id), "User must be our own: %s" % (user_id,)
# start by allocating a new room id
r = await self.store.get_room(old_room_id)