From 4d048af384799c6c9e94e392b5cb1e1e95438bb3 Mon Sep 17 00:00:00 2001 From: Sam Machin Date: Sat, 19 Mar 2022 13:34:46 +0000 Subject: [PATCH] Check for missing encrypted credentials --- .../@node-red/runtime/lib/nodes/credentials.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/runtime/lib/nodes/credentials.js b/packages/node_modules/@node-red/runtime/lib/nodes/credentials.js index 30b2ccdb0..356d5734e 100644 --- a/packages/node_modules/@node-red/runtime/lib/nodes/credentials.js +++ b/packages/node_modules/@node-red/runtime/lib/nodes/credentials.js @@ -239,7 +239,16 @@ var api = module.exports = { throw error; } } else { - credentialCache = credentials; + if (encryptionEnabled) { + // Our config expects the credentials to be encrypted but the encrypted object is not found + var error = new Error("Encrypted credentials not found"); + error.code = "credentials_load_failed"; + throw error + } else { + // credentialSecret is set to False + log.warn("Using Unecrypted credentials") + credentialCache = credentials; + } } if (clearInvalidFlag) { // TODO: this delves too deep into Project structure