Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix: correct secret key resolution when retrieving dashboard value

Scott Wilson19f392f889a6
diff --git a/backend/src/server/routes/v1/dashboard-router.ts b/backend/src/server/routes/v1/dashboard-router.ts
index 4e9d160bf7..8cf9604a43 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({