From 850aed8cfb915a59c1c1db6e870d052fd4a7ddab Mon Sep 17 00:00:00 2001 From: Alison Goryachev Date: Thu, 27 Jan 2022 08:26:56 -0500 Subject: [PATCH] [Upgrade Assistant] Minimize reindex attributes used to create credential hash (#123727) (#123864) --- .../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 66885a23cf96b6..b3d4d5e165a138 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 ({