From 831e671956676982574aab02f2987e53f09d047b Mon Sep 17 00:00:00 2001 From: Manuel Ruwe Date: Tue, 3 Jan 2023 20:36:58 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Accidential=20overwrite=20of=20a?= =?UTF-8?q?pp=20secrets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/api/configs/[slug].ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/pages/api/configs/[slug].ts b/src/pages/api/configs/[slug].ts index 3d1ea5605..a4bc6b5f1 100644 --- a/src/pages/api/configs/[slug].ts +++ b/src/pages/api/configs/[slug].ts @@ -45,13 +45,21 @@ function Put(req: NextApiRequest, res: NextApiResponse) { (previousProperty) => previousProperty.field === property.field ); + if (property.value !== undefined && property.value !== null) { + Consola.info( + 'Detected credential change of private secret. Value will be overwritten in configuration' + ); + return { + field: property.field, + type: property.type, + value: property.value, + }; + } + return { field: property.field, type: property.type, - value: - property.value !== undefined || property.value === null - ? property.value - : previousProperty?.value, + value: previousProperty?.value, }; }), },