mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Validate remote wipe confirm messages
This commit is contained in:
@@ -197,10 +197,10 @@ public class RemoteWipeManagerImpl extends ConversationClientImpl
|
||||
// Send a CONFIRM message to each wiper
|
||||
sendConfirmMessages(txn);
|
||||
|
||||
if (observer != null) {
|
||||
observer.onPanic();
|
||||
}
|
||||
txn.attach(new RemoteWipeActivatedEvent());
|
||||
// if (observer != null) {
|
||||
// observer.onPanic();
|
||||
// }
|
||||
// txn.attach(new RemoteWipeActivatedEvent());
|
||||
|
||||
// we could here clear the metadata to allow us to send
|
||||
// the wipe messages several times when testing
|
||||
@@ -233,6 +233,7 @@ public class RemoteWipeManagerImpl extends ConversationClientImpl
|
||||
clientHelper
|
||||
.mergeGroupMetadata(txn, localGroup.getId(), localRecord);
|
||||
} else if (type == CONFIRM) {
|
||||
LOG.info("*** Got confirm msg");
|
||||
messageTracker.trackIncomingMessage(txn, m);
|
||||
ContactId contactId = getContactId(txn, m.getGroupId());
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import javax.annotation.concurrent.Immutable;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static org.briarproject.bramble.util.ValidationUtils.checkSize;
|
||||
import static org.briarproject.briar.api.remotewipe.MessageType.CONFIRM;
|
||||
import static org.briarproject.briar.api.remotewipe.MessageType.REVOKE;
|
||||
import static org.briarproject.briar.api.remotewipe.MessageType.SETUP;
|
||||
import static org.briarproject.briar.api.remotewipe.MessageType.WIPE;
|
||||
@@ -42,6 +43,7 @@ class RemoteWipeValidator extends BdfMessageValidator {
|
||||
if (type == SETUP) return validateSetupMessage(body);
|
||||
else if (type == WIPE) return validateWipeMessage(body);
|
||||
else if (type == REVOKE) return validateRevokeMessage(body);
|
||||
else if (type == CONFIRM) return validateConfirmMessage(body);
|
||||
else throw new AssertionError();
|
||||
}
|
||||
|
||||
@@ -71,4 +73,13 @@ class RemoteWipeValidator extends BdfMessageValidator {
|
||||
new BdfEntry(MSG_KEY_LOCAL, false));
|
||||
return new BdfMessageContext(meta);
|
||||
}
|
||||
|
||||
private BdfMessageContext validateConfirmMessage(BdfList body)
|
||||
throws FormatException {
|
||||
checkSize(body, 1);
|
||||
BdfDictionary meta = BdfDictionary.of(
|
||||
new BdfEntry(MSG_KEY_MESSAGE_TYPE, CONFIRM.getValue()),
|
||||
new BdfEntry(MSG_KEY_LOCAL, false));
|
||||
return new BdfMessageContext(meta);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user