diff --git a/ts/test-both/util/privacy_test.ts b/ts/test-both/util/privacy_test.ts index a43b80ef580..b8a36e6f097 100644 --- a/ts/test-both/util/privacy_test.ts +++ b/ts/test-both/util/privacy_test.ts @@ -27,12 +27,16 @@ describe('Privacy', () => { it('should redact all uuids', () => { const text = 'This is a log line with a uuid 9e420799-acdf-4bf4-8dee-353d7e2096b4\n' + - 'and another one IN ALL UPPERCASE 340727FB-E43A-413B-941B-AADA033B6CA3'; + 'and another one IN ALL UPPERCASE 340727FB-E43A-413B-941B-AADA033B6CA3\n' + + 'and a v7 uuid: 019291b5-fea7-7007-9261-31ca82451a6e\n' + + 'and my story: 00000000-0000-0000-0000-000000000000'; const actual = Privacy.redactUuids(text); const expected = 'This is a log line with a uuid [REDACTED]6b4\n' + - 'and another one IN ALL UPPERCASE [REDACTED]CA3'; + 'and another one IN ALL UPPERCASE [REDACTED]CA3\n' + + 'and a v7 uuid: [REDACTED]a6e\n' + + 'and my story: [REDACTED]000'; assert.equal(actual, expected); }); }); diff --git a/ts/util/privacy.ts b/ts/util/privacy.ts index 73a647e0b96..3aacb2713e8 100644 --- a/ts/util/privacy.ts +++ b/ts/util/privacy.ts @@ -14,9 +14,9 @@ import type { ConversationModel } from '../models/conversations'; export const APP_ROOT_PATH = path.join(__dirname, '..', '..'); const PHONE_NUMBER_PATTERN = /\+\d{7,12}(\d{3})/g; -// The additional 0 in [04] and [089AB] are to include MY_STORY_ID +// The additional 0 in [0-8] and [089AB] are to include MY_STORY_ID const UUID_OR_STORY_ID_PATTERN = - /[0-9A-F]{8}-[0-9A-F]{4}-[04][0-9A-F]{3}-[089AB][0-9A-F]{3}-[0-9A-F]{9}([0-9A-F]{3})/gi; + /[0-9A-F]{8}-[0-9A-F]{4}-[0-8][0-9A-F]{3}-[089AB][0-9A-F]{3}-[0-9A-F]{9}([0-9A-F]{3})/gi; const GROUP_ID_PATTERN = /(group\()([^)]+)(\))/g; const GROUP_V2_ID_PATTERN = /(groupv2\()([^=)]+)(=?=?\))/g; const CALL_LINK_ROOM_ID_PATTERN = /[0-9A-F]{61}([0-9A-F]{3})/gi;