Skip to content

Commit efd082c

Browse files
Prevent injecting a forged encrypted message and using session_id/sender_key of another room.
1 parent c39d806 commit efd082c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/DefaultCryptoService.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,6 +1392,9 @@ internal class DefaultCryptoService @Inject constructor(
13921392
senderKey = sessionInfoPair.second,
13931393
sharedHistory = true
13941394
)
1395+
}?.filter { inboundGroupSession ->
1396+
// Prevent injecting a forged encrypted message and using session_id/sender_key of another room.
1397+
inboundGroupSession.roomId == roomId
13951398
}?.forEach { inboundGroupSession ->
13961399
// Share the sharable session to userId with deviceId
13971400
val exportedKeys = inboundGroupSession.exportKeys(sharedHistory = true)

0 commit comments

Comments
 (0)