Drop invalid keyChange messages on export

This commit is contained in:
trevor-signal
2025-11-21 13:36:30 -05:00
committed by GitHub
parent 1ed551b99a
commit 362dbe429d
2 changed files with 14 additions and 7 deletions

View File

@@ -1900,12 +1900,21 @@ export class BackupExportStream extends Readable {
const simpleUpdate = new Backups.SimpleChatUpdate(); const simpleUpdate = new Backups.SimpleChatUpdate();
simpleUpdate.type = Backups.SimpleChatUpdate.Type.IDENTITY_UPDATE; simpleUpdate.type = Backups.SimpleChatUpdate.Type.IDENTITY_UPDATE;
if (message.key_changed) { const conversation = window.ConversationController.get(
message.conversationId
);
if (
conversation &&
isGroup(conversation.attributes) &&
message.key_changed
) {
const target = window.ConversationController.get(message.key_changed); const target = window.ConversationController.get(message.key_changed);
if (!target) { if (!target) {
throw new Error( log.warn(
'toChatItemUpdate/keyCahnge: key_changed conversation not found!' 'toChatItemUpdate/keyChange: key_changed conversation not found!',
message.key_changed
); );
return { kind: NonBubbleResultKind.Drop };
} }
// This will override authorId on the original chatItem // This will override authorId on the original chatItem
patch.authorId = this.#getOrPushPrivateRecipient(target.attributes); patch.authorId = this.#getOrPushPrivateRecipient(target.attributes);

View File

@@ -181,11 +181,9 @@ export async function markConversationRead(
return undefined; return undefined;
} }
// This is expected for directionless messages which are inserted as Read but Unseen
// (e.g. keyChange)
if (!isAciString(senderAci)) { if (!isAciString(senderAci)) {
log.warn(
`${logId}: message sourceServiceId timestamp is not aci` +
`type=${messageSyncData.type}`
);
return undefined; return undefined;
} }