From 1b5c36a9a89209195abb2ac814c21efbf464bd3b Mon Sep 17 00:00:00 2001 From: Ken Powers Date: Mon, 27 Apr 2020 16:47:31 -0400 Subject: [PATCH] Add more safeguards to isTrustedIdentity --- js/signal_protocol_store.js | 6 ++++-- ts/util/lint/exceptions.json | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/js/signal_protocol_store.js b/js/signal_protocol_store.js index b43266192..f58bf68e0 100644 --- a/js/signal_protocol_store.js +++ b/js/signal_protocol_store.js @@ -501,9 +501,11 @@ throw new Error('Tried to get identity key for undefined/null key'); } const identifier = textsecure.utils.unencodeNumber(encodedAddress)[0]; + const ourNumber = textsecure.storage.user.getNumber(); + const ourUuid = textsecure.storage.user.getUuid(); const isOurIdentifier = - identifier === textsecure.storage.user.getNumber() || - identifier === textsecure.storage.user.getUuid(); + (ourNumber && identifier === ourNumber) || + (ourUuid && identifier === ourUuid); const identityRecord = this.getIdentityRecord(identifier); diff --git a/ts/util/lint/exceptions.json b/ts/util/lint/exceptions.json index 111f06f71..c38712d8f 100644 --- a/ts/util/lint/exceptions.json +++ b/ts/util/lint/exceptions.json @@ -317,9 +317,9 @@ "rule": "jQuery-load(", "path": "js/signal_protocol_store.js", "line": " await ConversationController.load();", - "lineNumber": 983, + "lineNumber": 985, "reasonCategory": "falseMatch", - "updated": "2020-02-28T18:14:42.951Z" + "updated": "2020-04-27T20:02:20.424Z" }, { "rule": "DOM-innerHTML",