mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-19 08:09:12 +01:00
Use both envelope.type and ciphertextMessageType in the validator.
This commit is contained in:
@@ -4,6 +4,7 @@ import okio.ByteString
|
||||
import okio.ByteString.Companion.toByteString
|
||||
import org.signal.core.models.ServiceId
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.signal.libsignal.protocol.message.CiphertextMessage
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase.Companion.groups
|
||||
import org.thoughtcrime.securesms.dependencies.AppDependencies
|
||||
import org.thoughtcrime.securesms.groups.GroupChangeBusyException
|
||||
@@ -47,7 +48,8 @@ class PushProcessMessageJob private constructor(
|
||||
sourceDeviceId = metadata.sourceDeviceId,
|
||||
sealedSender = metadata.sealedSender,
|
||||
groupId = if (metadata.groupId != null) metadata.groupId!!.toByteString() else null,
|
||||
destinationServiceId = ByteString.of(*metadata.destinationServiceId.toByteArray())
|
||||
destinationServiceId = ByteString.of(*metadata.destinationServiceId.toByteArray()),
|
||||
ciphertextMessageType = metadata.ciphertextMessageType
|
||||
),
|
||||
serverDeliveredTimestamp = serverDeliveredTimestamp
|
||||
).encode()
|
||||
@@ -84,7 +86,8 @@ class PushProcessMessageJob private constructor(
|
||||
sourceDeviceId = completeMessage.metadata.sourceDeviceId,
|
||||
sealedSender = completeMessage.metadata.sealedSender,
|
||||
groupId = completeMessage.metadata.groupId?.toByteArray(),
|
||||
destinationServiceId = ServiceId.parseOrThrow(completeMessage.metadata.destinationServiceId.toByteArray())
|
||||
destinationServiceId = ServiceId.parseOrThrow(completeMessage.metadata.destinationServiceId.toByteArray()),
|
||||
ciphertextMessageType = completeMessage.metadata.ciphertextMessageType ?: CiphertextMessage.WHISPER_TYPE
|
||||
),
|
||||
serverDeliveredTimestamp = completeMessage.serverDeliveredTimestamp
|
||||
)
|
||||
|
||||
@@ -177,7 +177,7 @@ object MessageDecryptor {
|
||||
|
||||
Log.d(TAG, "${logPrefix(envelope, cipherResult)} Successfully decrypted the envelope in ${(endTimeNanos - startTimeNanos).nanoseconds.toDouble(DurationUnit.MILLISECONDS).roundedString(2)} ms (GUID ${UuidUtil.getStringUUID(envelope.serverGuid, envelope.serverGuidBinary)}). Delivery latency: ${serverDeliveredTimestamp - envelope.serverTimestamp!!} ms, Urgent: ${envelope.urgent}")
|
||||
|
||||
val validationResult: EnvelopeContentValidator.Result = EnvelopeContentValidator.validate(envelope, cipherResult.content, SignalStore.account.aci!!)
|
||||
val validationResult: EnvelopeContentValidator.Result = EnvelopeContentValidator.validate(envelope, cipherResult.content, SignalStore.account.aci!!, cipherResult.metadata.ciphertextMessageType)
|
||||
|
||||
if (validationResult is EnvelopeContentValidator.Result.Invalid) {
|
||||
Log.w(TAG, "${logPrefix(envelope, cipherResult)} Invalid content! ${validationResult.reason}", validationResult.throwable)
|
||||
|
||||
Reference in New Issue
Block a user