mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 20:26:24 +00:00
Log when we clear profile name
This commit is contained in:
@@ -12,7 +12,11 @@ import type { ReadonlyDeep } from 'type-fest';
|
||||
import type { ConversationModel } from '../models/conversations.js';
|
||||
import type { CapabilitiesType } from '../types/Capabilities.d.ts';
|
||||
import type { ProfileType } from '../textsecure/WebAPI.js';
|
||||
import { getProfile, getProfileUnauth } from '../textsecure/WebAPI.js';
|
||||
import {
|
||||
checkAccountExistence,
|
||||
getProfile,
|
||||
getProfileUnauth,
|
||||
} from '../textsecure/WebAPI.js';
|
||||
import { MessageSender } from '../textsecure/SendMessage.js';
|
||||
import type { ServiceIdString } from '../types/ServiceId.js';
|
||||
import { DataWriter } from '../sql/Client.js';
|
||||
@@ -520,7 +524,6 @@ async function doGetProfile(
|
||||
});
|
||||
const { request } = options;
|
||||
|
||||
const isVersioned = request.profileKeyVersion != null;
|
||||
log.info(`${logId}: Fetching profile (${getFetchOptionsLabel(options)})`);
|
||||
|
||||
// Step #: Fetch profile
|
||||
@@ -577,15 +580,15 @@ async function doGetProfile(
|
||||
|
||||
// Not Found
|
||||
if (error.code === 404) {
|
||||
log.info(`${logId}: Profile not found`);
|
||||
log.info(`${logId}: Profile not found; checking account existence`);
|
||||
|
||||
c.set({ profileLastFetchedAt: Date.now() });
|
||||
|
||||
if (!isVersioned || ignoreProfileKey) {
|
||||
log.info(`${logId}: Marking conversation unregistered`);
|
||||
const doesAccountExist = await checkAccountExistence(serviceId);
|
||||
if (!doesAccountExist) {
|
||||
c.setUnregistered();
|
||||
}
|
||||
|
||||
c.set({ profileLastFetchedAt: Date.now() });
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -790,8 +793,11 @@ async function doGetProfile(
|
||||
);
|
||||
isSuccessfullyDecrypted = false;
|
||||
}
|
||||
} else {
|
||||
log.warn(`${logId}: No key to decrypt 'name' field; skipping`);
|
||||
}
|
||||
} else {
|
||||
log.warn(`${logId}: 'name' field missing; clearing profile name`);
|
||||
c.set({
|
||||
profileName: undefined,
|
||||
profileFamilyName: undefined,
|
||||
|
||||
@@ -13,7 +13,7 @@ describe('Privacy', () => {
|
||||
it('should redact anything that looks like a credit card', () => {
|
||||
const text =
|
||||
'This is a log line with a card number 1234-1234-1234-12\n' +
|
||||
'and another one 1234 1234 1234 1234 123';
|
||||
'and another one 1234123412341234123';
|
||||
|
||||
const actual = Privacy.redactCardNumbers(text);
|
||||
const expected =
|
||||
@@ -40,16 +40,8 @@ describe('Privacy', () => {
|
||||
'123-4-1-2-3-4-1-2-3-4-1-2-3-4-1-2\n' +
|
||||
'123-4-1-2-3-4-1-2-3-4-1-2-3-4-1-2-3\n' +
|
||||
'123-4-1-2-3-4-1-2-3-4-1-2-3-4-1-2-3-4\n' +
|
||||
'123 4 1 2 3 4 1 2 3 4 1\n' +
|
||||
'123 4 1 2 3 4 1 2 3 4 1 2\n' +
|
||||
'123 4 1 2 3 4 1 2 3 4 1 2 3\n' +
|
||||
'123 4 1 2 3 4 1 2 3 4 1 2 3 4\n' +
|
||||
'123 4 1 2 3 4 1 2 3 4 1 2 3 4 1\n' +
|
||||
'123 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2\n' +
|
||||
'123 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3\n' +
|
||||
'123 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4\n' +
|
||||
'123a412 3 4 1 2 3 4 1 2 3 4 1 2 3 4\n' +
|
||||
'123 4 1 2 3 4 1 2 3 4 1 2 3 4 1 a 2 3 4\n' +
|
||||
'123a412-3-4-1-2-3-4-1-2-3-4-1-2-3-4\n' +
|
||||
'123-4-1-2-3-4-1-2-3-4-1-2-3-4-1-a-2-3-4\n' +
|
||||
'';
|
||||
|
||||
const actual = Privacy.redactCardNumbers(text);
|
||||
@@ -70,16 +62,8 @@ describe('Privacy', () => {
|
||||
'[REDACTED]\n' +
|
||||
'[REDACTED]\n' +
|
||||
'[REDACTED]-4\n' +
|
||||
'123 4 1 2 3 4 1 2 3 4 1\n' +
|
||||
'[REDACTED]\n' +
|
||||
'[REDACTED]\n' +
|
||||
'[REDACTED]\n' +
|
||||
'[REDACTED]\n' +
|
||||
'[REDACTED]\n' +
|
||||
'[REDACTED]\n' +
|
||||
'[REDACTED] 4\n' +
|
||||
'123a[REDACTED]\n' +
|
||||
'[REDACTED] a 2 3 4\n' +
|
||||
'[REDACTED]-a-2-3-4\n' +
|
||||
'';
|
||||
assert.equal(actual, expected);
|
||||
});
|
||||
@@ -237,7 +221,7 @@ describe('Privacy', () => {
|
||||
'phone2 +13334445566 lorem\n' +
|
||||
'group2 group(abcdefghij) doloret\n' +
|
||||
'path3 sensitive-path/attachment.noindex\n' +
|
||||
'cc 1234 1234 1234 1234 and another 1234123412341234\n' +
|
||||
'cc 1234-1234-1234-1234 and another 1234123412341234\n' +
|
||||
'attachment://v2/ab/abcde?key=specialkey\n';
|
||||
|
||||
const actual = Privacy.redactAll(text);
|
||||
|
||||
@@ -27,7 +27,7 @@ const CALL_LINK_ROOT_KEY_PATTERN =
|
||||
/([A-Z]{4})-[A-Z]{4}-[A-Z]{4}-[A-Z]{4}-[A-Z]{4}-[A-Z]{4}-[A-Z]{4}-[A-Z]{4}/gi;
|
||||
const ATTACHMENT_URL_KEY_PATTERN = /(attachment:\/\/[^\s]+key=)([^\s]+)/gi;
|
||||
const REDACTION_PLACEHOLDER = '[REDACTED]';
|
||||
const CARD_NUMBER_PATTERN = /\d\d(\d[- ]?){11,16}\d/g;
|
||||
const CARD_NUMBER_PATTERN = /\d\d(\d[-]?){11,16}\d/g;
|
||||
|
||||
export type RedactFunction = (value: string) => string;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user