diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/DefaultCryptoService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/DefaultCryptoService.kt index 044f3e86f3..51e21a181e 100755 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/DefaultCryptoService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/DefaultCryptoService.kt @@ -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) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/MXMegolmEncryption.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/MXMegolmEncryption.kt index 975530f5c5..740676cd59 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/MXMegolmEncryption.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/algorithms/megolm/MXMegolmEncryption.kt @@ -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.") diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/DefaultMembershipService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/DefaultMembershipService.kt index 0f82872f23..fdda38777a 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/DefaultMembershipService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/membership/DefaultMembershipService.kt @@ -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,