mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-23 19:26:17 +00:00
Ignore PNI messages for everything except server delivery receipts.
This commit is contained in:
committed by
Jeffrey Starke
parent
04923487c4
commit
228a993237
@@ -130,6 +130,12 @@ object MessageDecryptor {
|
||||
return Result.Ignore(envelope, serverDeliveredTimestamp, emptyList())
|
||||
}
|
||||
|
||||
val sourceServiceId = ServiceId.parseOrNull(envelope.sourceServiceId)
|
||||
if (sourceServiceId is PNI && envelope.type != Envelope.Type.SERVER_DELIVERY_RECEIPT) {
|
||||
Log.w(TAG, "${logPrefix(envelope)} Got a message from a PNI that was not a SERVER_DELIVERY_RECEIPT.")
|
||||
return Result.Ignore(envelope, serverDeliveredTimestamp, emptyList())
|
||||
}
|
||||
|
||||
val followUpOperations: MutableList<FollowUpOperation> = mutableListOf()
|
||||
|
||||
if (envelope.type == Envelope.Type.PREKEY_BUNDLE) {
|
||||
@@ -153,6 +159,11 @@ object MessageDecryptor {
|
||||
return Result.Ignore(envelope, serverDeliveredTimestamp, followUpOperations.toUnmodifiableList())
|
||||
}
|
||||
|
||||
if (cipherResult.metadata.sourceServiceId is PNI && envelope.sourceServiceId == null) {
|
||||
Log.w(TAG, "${logPrefix(envelope)} Invalid message! Sealed sender used for a PNI.")
|
||||
return Result.Ignore(envelope, serverDeliveredTimestamp, followUpOperations.toUnmodifiableList())
|
||||
}
|
||||
|
||||
Log.d(TAG, "${logPrefix(envelope, cipherResult)} Successfully decrypted the envelope in ${(endTimeNanos - startTimeNanos).nanoseconds.toDouble(DurationUnit.MILLISECONDS).roundedString(2)} ms (GUID ${envelope.serverGuid}). Delivery latency: ${serverDeliveredTimestamp - envelope.serverTimestamp!!} ms, Urgent: ${envelope.urgent}")
|
||||
|
||||
val validationResult: EnvelopeContentValidator.Result = EnvelopeContentValidator.validate(envelope, cipherResult.content, SignalStore.account.aci!!)
|
||||
|
||||
Reference in New Issue
Block a user