From f9c2e9b0af7d8f641706c416d8d74d3cf10aae02 Mon Sep 17 00:00:00 2001 From: Josh Perez <60019601+josh-signal@users.noreply.github.com> Date: Thu, 11 Aug 2022 17:02:25 -0400 Subject: [PATCH] softAssert that messageId is always a UUID --- ts/sql/Client.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ts/sql/Client.ts b/ts/sql/Client.ts index eea3215175..8744b58aa1 100644 --- a/ts/sql/Client.ts +++ b/ts/sql/Client.ts @@ -26,7 +26,7 @@ import { tapToViewMessagesDeletionService } from '../services/tapToViewMessagesD import * as Bytes from '../Bytes'; import { CURRENT_SCHEMA_VERSION } from '../types/Message2'; import { createBatcher } from '../util/batcher'; -import { assert, strictAssert } from '../util/assert'; +import { assert, softAssert, strictAssert } from '../util/assert'; import { mapObjectWithSpec } from '../util/mapObjectWithSpec'; import type { ObjectMappingSpecType } from '../util/mapObjectWithSpec'; import { cleanDataForIpc } from './cleanDataForIpc'; @@ -38,6 +38,7 @@ import type { ProcessGroupCallRingRequestResult } from '../types/Calling'; import type { RemoveAllConfiguration } from '../types/RemoveAllConfiguration'; import createTaskWithTimeout from '../textsecure/TaskWithTimeout'; import * as log from '../logging/log'; +import { isValidUuid } from '../types/UUID'; import type { StoredJob } from '../jobs/types'; import { formatJobForInsert } from '../jobs/formatJobForInsert'; @@ -1169,6 +1170,8 @@ async function saveMessage( jobToInsert: options.jobToInsert && formatJobForInsert(options.jobToInsert), }); + softAssert(isValidUuid(id), 'saveMessage: messageId is not a UUID'); + expiringMessagesDeletionService.update(); tapToViewMessagesDeletionService.update();