diff --git a/lib/utils/sanitization.js b/lib/utils/sanitization.js --- a/lib/utils/sanitization.js +++ b/lib/utils/sanitization.js @@ -72,10 +72,18 @@ 'curve25519', 'picklingKey', 'pickledAccount', + 'commServicesAccessToken', + 'blobHash', + 'blobHolder', + 'holder', + 'thumbnailHolder', + 'encryptionKey', + 'thumbnailEncryptionKey', ]); // eg {"memberIDs":["123", "456"]} => {"memberIDs":["redacted", "redacted"]} const keysWithArraysToBeRedacted = new Set([ + 'devices', 'memberIDs', 'messageIDs', 'already_friends', @@ -109,6 +117,10 @@ 'thumbnailURI', ]); +// eg {"uri":"comm-blob-service://1a2b3c4d5e6f"} +// => {"uri":"comm-blob-service://placeholder"} +const keysWithBlobURIsToBeReplaced = new Set(['blobURI, thumbnailBlobURI']); + // (special case that redacts triply-linked [] to handle `daysToEntries` ) // eg "daysToEntries":{"2020-12-29":["123"]} // => "daysToEntries":{"2020-12-29":["redacted"]} @@ -132,6 +144,10 @@ return 'https://comm.app/images/placeholder.png'; } +function placeholderBlobURI(): string { + return 'comm-blob-service://placeholder'; +} + function scrambleText(str: string): string { const arr = []; for (const char of new String(str)) { @@ -233,6 +249,8 @@ obj[k] = scrambleText(obj[k]); } else if (keysWithImageURIsToBeReplaced.has(k)) { obj[k] = placeholderImageURI(); + } else if (keysWithBlobURIsToBeReplaced.has(k)) { + obj[k] = placeholderBlobURI(); } else if (keysWithArraysToBeRedacted.has(k)) { obj[k] = obj[k].map(redactionHelpers.redactString); } else if (typeof obj[k] === 'object') {