Harden UUID-handling code paths

This commit is contained in:
Ken Powers 2020-06-12 18:36:32 -04:00 committed by Scott Nonnenberg
parent d3a27a6442
commit bf04c9114e
10 changed files with 193 additions and 124 deletions

View file

@ -152,10 +152,7 @@
encodedAddress
);
try {
const conv = await ConversationController.getOrCreateAndWait(
identifier,
'private'
);
const conv = ConversationController.getOrCreate(identifier, 'private');
return `${conv.get('id')}.${deviceId}`;
} catch (e) {
window.log.error(
@ -585,7 +582,9 @@
const identifier = textsecure.utils.unencodeNumber(encodedAddress)[0];
const identityRecord = this.getIdentityRecord(identifier);
const id = ConversationController.getConversationId(identifier);
const id = ConversationController.getOrCreate(identifier, 'private').get(
'id'
);
if (!identityRecord || !identityRecord.publicKey) {
// Lookup failed, or the current key was removed, so save this one.
@ -661,10 +660,7 @@
const identifier = textsecure.utils.unencodeNumber(encodedAddress)[0];
const identityRecord = this.getIdentityRecord(identifier);
const conv = await ConversationController.getOrCreateAndWait(
identifier,
'private'
);
const conv = ConversationController.getOrCreate(identifier, 'private');
const id = conv.get('id');
const updates = {