From 96fea80d7282b7cf37512bb117f528d38162ec1e Mon Sep 17 00:00:00 2001 From: Alison Goryachev Date: Thu, 27 Jan 2022 09:53:15 -0500 Subject: [PATCH] [Upgrade Assistant] Minimize reindex attributes used to create credential hash (#123727) (#123864) (#123925) (cherry picked from commit 94e64e4da53c3bd52a0f593906bf82b8dc31a3d0) --- .../server/lib/reindexing/credential_store.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/upgrade_assistant/server/lib/reindexing/credential_store.ts b/x-pack/plugins/upgrade_assistant/server/lib/reindexing/credential_store.ts index 66885a23cf96b..b3d4d5e165a13 100644 --- a/x-pack/plugins/upgrade_assistant/server/lib/reindexing/credential_store.ts +++ b/x-pack/plugins/upgrade_assistant/server/lib/reindexing/credential_store.ts @@ -16,10 +16,14 @@ import { ReindexSavedObject, ReindexStatus } from '../../../common/types'; export type Credential = Record; // Generates a stable hash for the reindex operation's current state. -const getHash = (reindexOp: ReindexSavedObject) => - createHash('sha256') - .update(stringify({ id: reindexOp.id, ...reindexOp.attributes })) +const getHash = (reindexOp: ReindexSavedObject) => { + // Remove reindexOptions from the SO attributes as it creates an unstable hash + // This needs further investigation, see: https://github.com/elastic/kibana/issues/123752 + const { reindexOptions, ...attributes } = reindexOp.attributes; + return createHash('sha256') + .update(stringify({ id: reindexOp.id, ...attributes })) .digest('base64'); +}; // Returns a base64-encoded API key string or undefined const getApiKey = async ({