mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Fix issue when receiving invalid message from invalid sender
This commit is contained in:
parent
605f31d1ad
commit
ca5951861a
1 changed files with 16 additions and 10 deletions
|
@ -139,18 +139,24 @@ public final class IncomingMessageHandler {
|
||||||
} else {
|
} else {
|
||||||
final var senderProfile = context.getProfileHelper().getRecipientProfile(sender);
|
final var senderProfile = context.getProfileHelper().getRecipientProfile(sender);
|
||||||
final var selfProfile = context.getProfileHelper().getSelfProfile();
|
final var selfProfile = context.getProfileHelper().getSelfProfile();
|
||||||
final var serviceId = ServiceId.parseOrThrow(e.getSender());
|
final var serviceId = ServiceId.parseOrNull(e.getSender());
|
||||||
if ((!sender.equals(account.getSelfRecipientId()) || e.getSenderDevice() != account.getDeviceId())
|
if (serviceId != null) {
|
||||||
&& senderProfile != null
|
final var isSelf = sender.equals(account.getSelfRecipientId())
|
||||||
&& senderProfile.getCapabilities().contains(Profile.Capability.senderKey)
|
&& e.getSenderDevice() == account.getDeviceId();
|
||||||
&& selfProfile != null
|
final var isSenderSenderKeyCapable = senderProfile != null && senderProfile.getCapabilities()
|
||||||
&& selfProfile.getCapabilities().contains(Profile.Capability.senderKey)) {
|
.contains(Profile.Capability.senderKey);
|
||||||
|
final var isSelfSenderKeyCapable = selfProfile != null && selfProfile.getCapabilities()
|
||||||
|
.contains(Profile.Capability.senderKey);
|
||||||
|
if (!isSelf && isSenderSenderKeyCapable && isSelfSenderKeyCapable) {
|
||||||
logger.debug("Received invalid message, requesting message resend.");
|
logger.debug("Received invalid message, requesting message resend.");
|
||||||
actions.add(new SendRetryMessageRequestAction(sender, serviceId, e, envelope));
|
actions.add(new SendRetryMessageRequestAction(sender, serviceId, e, envelope));
|
||||||
} else {
|
} else {
|
||||||
logger.debug("Received invalid message, queuing renew session action.");
|
logger.debug("Received invalid message, queuing renew session action.");
|
||||||
actions.add(new RenewSessionAction(sender, serviceId));
|
actions.add(new RenewSessionAction(sender, serviceId));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
logger.debug("Received invalid message from invalid sender: {}", e.getSender());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exception = e;
|
exception = e;
|
||||||
} catch (SelfSendException e) {
|
} catch (SelfSendException e) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue