mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-17 21:29:54 +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
|
// Send a CONFIRM message to each wiper
|
||||||
sendConfirmMessages(txn);
|
sendConfirmMessages(txn);
|
||||||
|
|
||||||
if (observer != null) {
|
// if (observer != null) {
|
||||||
observer.onPanic();
|
// observer.onPanic();
|
||||||
}
|
// }
|
||||||
txn.attach(new RemoteWipeActivatedEvent());
|
// txn.attach(new RemoteWipeActivatedEvent());
|
||||||
|
|
||||||
// we could here clear the metadata to allow us to send
|
// we could here clear the metadata to allow us to send
|
||||||
// the wipe messages several times when testing
|
// the wipe messages several times when testing
|
||||||
@@ -233,6 +233,7 @@ public class RemoteWipeManagerImpl extends ConversationClientImpl
|
|||||||
clientHelper
|
clientHelper
|
||||||
.mergeGroupMetadata(txn, localGroup.getId(), localRecord);
|
.mergeGroupMetadata(txn, localGroup.getId(), localRecord);
|
||||||
} else if (type == CONFIRM) {
|
} else if (type == CONFIRM) {
|
||||||
|
LOG.info("*** Got confirm msg");
|
||||||
messageTracker.trackIncomingMessage(txn, m);
|
messageTracker.trackIncomingMessage(txn, m);
|
||||||
ContactId contactId = getContactId(txn, m.getGroupId());
|
ContactId contactId = getContactId(txn, m.getGroupId());
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import javax.annotation.concurrent.Immutable;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import static org.briarproject.bramble.util.ValidationUtils.checkSize;
|
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.REVOKE;
|
||||||
import static org.briarproject.briar.api.remotewipe.MessageType.SETUP;
|
import static org.briarproject.briar.api.remotewipe.MessageType.SETUP;
|
||||||
import static org.briarproject.briar.api.remotewipe.MessageType.WIPE;
|
import static org.briarproject.briar.api.remotewipe.MessageType.WIPE;
|
||||||
@@ -42,6 +43,7 @@ class RemoteWipeValidator extends BdfMessageValidator {
|
|||||||
if (type == SETUP) return validateSetupMessage(body);
|
if (type == SETUP) return validateSetupMessage(body);
|
||||||
else if (type == WIPE) return validateWipeMessage(body);
|
else if (type == WIPE) return validateWipeMessage(body);
|
||||||
else if (type == REVOKE) return validateRevokeMessage(body);
|
else if (type == REVOKE) return validateRevokeMessage(body);
|
||||||
|
else if (type == CONFIRM) return validateConfirmMessage(body);
|
||||||
else throw new AssertionError();
|
else throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,4 +73,13 @@ class RemoteWipeValidator extends BdfMessageValidator {
|
|||||||
new BdfEntry(MSG_KEY_LOCAL, false));
|
new BdfEntry(MSG_KEY_LOCAL, false));
|
||||||
return new BdfMessageContext(meta);
|
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