This commit is contained in:
ariskotsomitopoulos 2022-04-29 14:19:22 +03:00 committed by Valere
parent 395d48f946
commit 243463adbc
3 changed files with 8 additions and 3 deletions

View file

@ -1357,7 +1357,9 @@ internal class DefaultCryptoService @Inject constructor(
)
}?.filter { inboundGroupSession ->
// Prevent injecting a forged encrypted message and using session_id/sender_key of another room.
inboundGroupSession.roomId == roomId
(inboundGroupSession.roomId == roomId).also {
Timber.tag(loggerTag.value).d("Forged encrypted message detected for roomId:$roomId")
}
}?.forEach { inboundGroupSession ->
// Share the sharable session to userId with deviceId
val exportedKeys = inboundGroupSession.exportKeys(sharedHistory = true)

View file

@ -173,7 +173,11 @@ internal class MXMegolmEncryption(
// Need to make a brand new session?
session.needsRotation(sessionRotationPeriodMsgs, sessionRotationPeriodMs) ||
// Is there a room history visibility change since the last outboundSession
cryptoStore.needsRotationDueToVisibilityChange(roomId) ||
cryptoStore.needsRotationDueToVisibilityChange(roomId).also {
if (it) {
Timber.tag(loggerTag.value).d("roomId:$roomId Room history visibility change detected since the last outbound session")
}
} ||
// Determine if we have shared with anyone we shouldn't have
session.sharedWithTooManyDevices(devicesInRoom)) {
Timber.tag(loggerTag.value).d("roomId:$roomId Starting new megolm session because we need to rotate.")

View file

@ -45,7 +45,6 @@ import org.matrix.android.sdk.internal.session.room.membership.admin.MembershipA
import org.matrix.android.sdk.internal.session.room.membership.joining.InviteTask
import org.matrix.android.sdk.internal.session.room.membership.threepid.InviteThreePidTask
import org.matrix.android.sdk.internal.util.fetchCopied
import timber.log.Timber
internal class DefaultMembershipService @AssistedInject constructor(
@Assisted private val roomId: String,