From a13ec69613cb2ad11882b85f9786482816c7f80f Mon Sep 17 00:00:00 2001 From: Ashoat Tevosyan Date: Tue, 24 Oct 2023 15:10:27 -0400 Subject: [PATCH] [keyserver] Remove extraneous verifyClientSupported calls Summary: In the past, we had calls to `validateInput` in each responder, which in turn calls `verifyClientSupported`. When the input did not need validation because there was no input, we would instead add direct calls to `verifyClientSupported`. However, now `validateInput` is called implicitly before each responder. As such, `verifyClientSupported` is also called implicitly, and we don't need any explicit calls to it in responders. Test Plan: Careful reading of the code. I think this change is relatively safe since I'm just removing a call that already occurs elsewhere Reviewers: michal, marcin Reviewed By: marcin Subscribers: tomek, wyilio Differential Revision: https://phab.comm.dev/D9581 --- keyserver/src/responders/keys-responders.js | 7 +------ keyserver/src/responders/user-responders.js | 7 ------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/keyserver/src/responders/keys-responders.js b/keyserver/src/responders/keys-responders.js index 1050f4b29e..4cb9903432 100644 --- a/keyserver/src/responders/keys-responders.js +++ b/keyserver/src/responders/keys-responders.js @@ -16,7 +16,6 @@ import { ServerError } from 'lib/utils/errors.js'; import { tShape, tNull } from 'lib/utils/validation-utils.js'; import { fetchSessionPublicKeys } from '../fetchers/key-fetchers.js'; -import { verifyClientSupported } from '../session/version.js'; import type { Viewer } from '../session/viewer.js'; import { fetchCallUpdateOlmAccount } from '../updaters/olm-account-updater.js'; @@ -63,11 +62,7 @@ function retrieveSessionInitializationKeysSet( return { identityKeys, oneTimeKey, prekey, prekeySignature }; } -async function getOlmSessionInitializationDataResponder( - viewer: Viewer, -): Promise { - await verifyClientSupported(viewer); - +async function getOlmSessionInitializationDataResponder(): Promise { const { identityKeys: notificationsIdentityKeys, prekey: notificationsPrekey, diff --git a/keyserver/src/responders/user-responders.js b/keyserver/src/responders/user-responders.js index d13ad97674..055932e402 100644 --- a/keyserver/src/responders/user-responders.js +++ b/keyserver/src/responders/user-responders.js @@ -120,7 +120,6 @@ import { createNewUserCookie, setNewSession, } from '../session/cookies.js'; -import { verifyClientSupported } from '../session/version.js'; import type { Viewer } from '../session/viewer.js'; import { accountUpdater, @@ -176,9 +175,6 @@ async function passwordUpdateResponder( } async function sendVerificationEmailResponder(viewer: Viewer): Promise { - if (!viewer.isSocket) { - await verifyClientSupported(viewer, viewer.platformDetails); - } await checkAndSendVerificationEmail(viewer); } @@ -200,9 +196,6 @@ export const logOutResponseValidator: TInterface = }); async function logOutResponder(viewer: Viewer): Promise { - if (!viewer.isSocket) { - await verifyClientSupported(viewer, viewer.platformDetails); - } if (viewer.loggedIn) { const [anonymousViewerData] = await Promise.all([ createNewAnonymousCookie({