Improve UUIDv7 handling
This commit is contained in:
parent
c068cb7bd3
commit
fffdf7f42c
2 changed files with 8 additions and 4 deletions
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue