From 19f392f889a690a4be1d6f78891643507c828184 Mon Sep 17 00:00:00 2001 From: Scott Wilson Date: Fri, 19 Sep 2025 13:04:21 -0700 Subject: [PATCH] fix: correct secret key resolution when retrieving dashboard value --- backend/src/server/routes/v1/dashboard-router.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/src/server/routes/v1/dashboard-router.ts b/backend/src/server/routes/v1/dashboard-router.ts index 4e9d160bf..8cf9604a4 100644 --- a/backend/src/server/routes/v1/dashboard-router.ts +++ b/backend/src/server/routes/v1/dashboard-router.ts @@ -1457,6 +1457,7 @@ export const registerDashboardRouter = async (server: FastifyZodProvider) => { handler: async (req) => { const { secretPath, projectId, environment, secretKey, isOverride } = req.query; + // TODO (scott): just get the secret instead of searching for it in list const { secrets } = await server.services.secret.getSecretsRaw({ actorId: req.permission.id, actor: req.permission.type, @@ -1473,7 +1474,9 @@ export const registerDashboardRouter = async (server: FastifyZodProvider) => { }); if (isOverride) { - const personalSecret = secrets.find((secret) => secret.type === SecretType.Personal); + const personalSecret = secrets.find( + (secret) => secret.type === SecretType.Personal && secret.secretKey === secretKey + ); if (!personalSecret) throw new BadRequestError({ @@ -1486,7 +1489,9 @@ export const registerDashboardRouter = async (server: FastifyZodProvider) => { }; } - const sharedSecret = secrets.find((secret) => secret.type === SecretType.Shared); + const sharedSecret = secrets.find( + (secret) => secret.type === SecretType.Shared && secret.secretKey === secretKey + ); if (!sharedSecret) throw new BadRequestError({