From 5a6b5f2caee61e0b23fd22603044bdc1a7417908 Mon Sep 17 00:00:00 2001 From: ShahanaFarooqui Date: Thu, 20 Jun 2024 13:26:21 -0700 Subject: [PATCH] Check for authentication obj before delete operation #1415 (#1416) (#1417) --- backend/utils/common.js | 12 +++++++----- server/utils/common.ts | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/backend/utils/common.js b/backend/utils/common.js index de988150..797bf8b5 100644 --- a/backend/utils/common.js +++ b/backend/utils/common.js @@ -40,11 +40,13 @@ export class CommonService { return obj; }; this.removeAuthSecureData = (node) => { - delete node.authentication.macaroonPath; - delete node.authentication.runePath; - delete node.authentication.runeValue; - delete node.authentication.lnApiPassword; - delete node.authentication.options; + if (node.authentication) { + delete node.authentication.macaroonPath; + delete node.authentication.runePath; + delete node.authentication.runeValue; + delete node.authentication.lnApiPassword; + delete node.authentication.options; + } return node; }; this.removeSecureData = (config) => { diff --git a/server/utils/common.ts b/server/utils/common.ts index 654d8655..165d6df5 100644 --- a/server/utils/common.ts +++ b/server/utils/common.ts @@ -47,11 +47,13 @@ export class CommonService { }; public removeAuthSecureData = (node: SelectedNode) => { - delete node.authentication.macaroonPath; - delete node.authentication.runePath; - delete node.authentication.runeValue; - delete node.authentication.lnApiPassword; - delete node.authentication.options; + if (node.authentication) { + delete node.authentication.macaroonPath; + delete node.authentication.runePath; + delete node.authentication.runeValue; + delete node.authentication.lnApiPassword; + delete node.authentication.options; + } return node; };