Prevent injecting a forged encrypted message and using session_id/sender_key of another room.

This commit is contained in:
ariskotsomitopoulos 2022-04-28 17:15:46 +03:00 committed by Valere
parent 28a3ae264c
commit d6358dcb16

View file

@ -1354,6 +1354,9 @@ internal class DefaultCryptoService @Inject constructor(
senderKey = sessionInfoPair.second,
sharedHistory = true
)
}?.filter { inboundGroupSession ->
// Prevent injecting a forged encrypted message and using session_id/sender_key of another room.
inboundGroupSession.roomId == roomId
}?.forEach { inboundGroupSession ->
// Share the sharable session to userId with deviceId
val exportedKeys = inboundGroupSession.exportKeys(sharedHistory = true)