File tree Expand file tree Collapse file tree 1 file changed +18
-10
lines changed
packages/federation-sdk/src/services Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -149,16 +149,24 @@ export class InviteService {
149149 }
150150
151151 private async shouldProcessInvite (
152- strippedStateEvents : PduForType <
153- | 'm.room.create'
154- | 'm.room.name'
155- | 'm.room.avatar'
156- | 'm.room.topic'
157- | 'm.room.join_rules'
158- | 'm.room.canonical_alias'
159- | 'm.room.encryption'
160- > [ ] ,
152+ strippedStateEvents :
153+ | PduForType <
154+ | 'm.room.create'
155+ | 'm.room.name'
156+ | 'm.room.avatar'
157+ | 'm.room.topic'
158+ | 'm.room.join_rules'
159+ | 'm.room.canonical_alias'
160+ | 'm.room.encryption'
161+ > [ ]
162+ | undefined ,
161163 ) : Promise < void > {
164+ if ( ! strippedStateEvents || strippedStateEvents . length === 0 ) {
165+ throw new Error (
166+ 'Missing invite_room_state required for policy validation' ,
167+ ) ;
168+ }
169+
162170 const isRoomNonPrivate = strippedStateEvents . some (
163171 ( stateEvent ) =>
164172 stateEvent . type === 'm.room.join_rules' &&
@@ -188,7 +196,7 @@ export class InviteService {
188196 roomVersion : RoomVersion ,
189197 ) : Promise < PersistentEventBase < RoomVersion , 'm.room.member' > > {
190198 // SPEC: when a user invites another user on a different homeserver, a request to that homeserver to have the event signed and verified must be made
191- await this . shouldProcessInvite ( event . unsigned . invite_room_state ) ;
199+ await this . shouldProcessInvite ( event . unsigned ? .invite_room_state ) ;
192200
193201 const inviteEvent =
194202 PersistentEventFactory . createFromRawEvent < 'm.room.member' > (
You can’t perform that action at this time.
0 commit comments