From a6f767844c6848f4d9f5aecc7a6579028d73fa2b Mon Sep 17 00:00:00 2001 From: RunOnFlux Date: Tue, 14 Jan 2025 13:06:26 +0000 Subject: [PATCH] Update from https://github.com/RunOnFlux/flux/commit/8ecd2f34059926593ae6aa629a1655a9a052ce0b --- services/appsService.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/services/appsService.js b/services/appsService.js index b9b8ab56..69149606 100644 --- a/services/appsService.js +++ b/services/appsService.js @@ -4890,7 +4890,7 @@ async function checkAppSecrets(appName, appComponentSpecs, appOwner, registratio for (const component of app.compose) { if (component.secrets.length > 0 && JSON.stringify(component.secrets.replace(/(\r\n|\n|\r)/gm, '').replace(/\\/g, '')) === JSON.stringify(appComponentSpecs.secrets.replace(/(\r\n|\n|\r)/gm, '').replace(/\\/g, ''))) { if (registration) { - throw new Error(`Provided component ${component.name} secrets are not valid`); + throw new Error(`Provided component ${appComponentSpecs.name} secrets are not valid`); } else if (app.name !== appName) { foundSecretsWithDifferentAppName = true; } else if (app.name === appName) { @@ -4912,9 +4912,13 @@ async function checkAppSecrets(appName, appComponentSpecs, appOwner, registratio // eslint-disable-next-line no-restricted-syntax for (const component of message.appSpecifications.compose) { if (component.secrets.length > 0 - && JSON.stringify(component.secrets.replace(/(\r\n|\n|\r)/gm, '').replace(/\\/g, '')) === JSON.stringify(appComponentSpecs.secrets.replace(/(\r\n|\n|\r)/gm, '').replace(/\\/g, '')) - && message.appSpecifications.owner !== appOwner) { - throw new Error(`Provided component ${component.name} secrets are not valid`); + && JSON.stringify(component.secrets.replace(/(\r\n|\n|\r)/gm, '').replace(/\\/g, '')) === JSON.stringify(appComponentSpecs.secrets.replace(/(\r\n|\n|\r)/gm, '').replace(/\\/g, ''))) { + log.info('checkAppSecrets - found same secret'); + log.info(`checkAppSecrets - appOwner: ${appOwner}`); + log.info(`checkAppSecrets - appOwner: ${message.appSpecifications.owner}`); + if (message.appSpecifications.owner !== appOwner) { + throw new Error(`Provided component ${appComponentSpecs.name} secrets are not valid`); + } } } }