From 5f3ec0846e4125b4bff5f255d976cb8f97349032 Mon Sep 17 00:00:00 2001 From: ameba23 Date: Tue, 11 May 2021 11:03:08 +0200 Subject: [PATCH] Ignore old wipe messages when receiving --- .../briar/remotewipe/RemoteWipeManagerImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/briar-core/src/main/java/org/briarproject/briar/remotewipe/RemoteWipeManagerImpl.java b/briar-core/src/main/java/org/briarproject/briar/remotewipe/RemoteWipeManagerImpl.java index fb1e8544d..6234500e3 100644 --- a/briar-core/src/main/java/org/briarproject/briar/remotewipe/RemoteWipeManagerImpl.java +++ b/briar-core/src/main/java/org/briarproject/briar/remotewipe/RemoteWipeManagerImpl.java @@ -127,10 +127,12 @@ public class RemoteWipeManagerImpl extends ConversationClientImpl // txn.attach event } else if (type == WIPE) { if (!remoteWipeIsSetup(txn)) return false; + if (clock.currentTimeMillis() - m.getTimestamp() > MAX_MESSAGE_AGE) return false; + ContactId contactId = getContactId(txn, m.getGroupId()); // Check if contact is in list of wipers if (findMessage(txn, m.getGroupId(), SETUP, true) != null) { - System.out.println("Got a wipe message from a wiper"); + System.out.println("Got a valid wipe message from a wiper"); BdfDictionary existingMeta = clientHelper.getGroupMetadataAsDictionary(txn, localGroup.getId()); @@ -165,8 +167,7 @@ public class RemoteWipeManagerImpl extends ConversationClientImpl } else { BdfList newReceivedWipeMessage = new BdfList(); newReceivedWipeMessage.add(contactId.getInt()); - long timestamp = m.getTimestamp(); - newReceivedWipeMessage.add(timestamp); + newReceivedWipeMessage.add(m.getTimestamp()); receivedWipeMessages.add(newReceivedWipeMessage); BdfDictionary newMeta = new BdfDictionary(); newMeta.put(GROUP_KEY_RECEIVED_WIPE, receivedWipeMessages);