Skip to content

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

mask unreadable values instead of failing the overview batch

DimitrisStaratzise9339ca56748
diff --git a/backend/src/server/routes/v1/dashboard-router.ts b/backend/src/server/routes/v1/dashboard-router.ts
index 278302385e..ce4a489fcd 100644
--- a/backend/src/server/routes/v1/dashboard-router.ts
+++ b/backend/src/server/routes/v1/dashboard-router.ts
@@ -1882,7 +1882,10 @@ export const registerDashboardRouter = async (server: FastifyZodProvider) => {
environment: z.string().trim(),
secretPath: z.string().trim().default("/").transform(removeTrailingSlash),
keys: z.string().trim().transform(decodeURIComponent),
- viewSecretValue: booleanSchema.default(false)
+ viewSecretValue: booleanSchema.default(false),
+ // returns unreadable values masked instead of refusing the whole request, so one shared value
+ // the user cannot read does not stop the overview from loading the rest in bulk
+ hideUnreadableValues: booleanSchema.default(false)
}),
response: {
200: z.object({
@@ -1901,7 +1904,7 @@ export const registerDashboardRouter = async (server: FastifyZodProvider) => {
},
onRequest: verifyAuth([AuthMode.JWT, AuthMode.OAUTH]),
handler: async (req) => {
- const { secretPath, projectId, environment, viewSecretValue } = req.query;
+ const { secretPath, projectId, environment, viewSecretValue, hideUnreadableValues } = req.query;
const keys = req.query.keys?.split(",").filter((key) => Boolean(key.trim())) ?? [];
if (!keys.length) throw new BadRequestError({ message: "One or more keys required" });
@@ -1913,6 +1916,7 @@ export const registerDashboardRouter = async (server: FastifyZodProvider) => {
actor: req.permission.type,
actorOrgId: req.permission.orgId,
viewSecretValue,
+ throwOnMissingReadValuePermission: !hideUnreadableValues,
environment,
actorAuthMethod: req.permission.authMethod,
projectId,
diff --git a/frontend/src/hooks/api/dashboard/queries.tsx b/frontend/src/hooks/api/dashboard/queries.tsx
index f0cd489d70..b36fa39432 100644
--- a/frontend/src/hooks/api/dashboard/queries.tsx
+++ b/frontend/src/hooks/api/dashboard/queries.tsx
@@ -717,10 +717,12 @@ const fetchSecretValueGroup = async (requests: TPendingSecretValue[]) => {
environment,
secretPath,
keys: [...new Set(requests.map(({ params }) => params.secretKey))],
- viewSecretValue: true
+ viewSecretValue: true,
+ hideUnreadableValues: true
}));
} catch (error) {
- // one value the user cannot read fails the whole request, so each value is fetched on its own
+ // unreadable values come back masked, so a refusal here is about the request as a whole; each
+ // value is fetched on its own so every row still gets its own result
if (error instanceof AxiosError && error.status === 403) {
fetchSecretValuesIndividually(requests);
} else {
diff --git a/frontend/src/hooks/api/dashboard/types.ts b/frontend/src/hooks/api/dashboard/types.ts
index b2d5a3452f..aa9903668f 100644
--- a/frontend/src/hooks/api/dashboard/types.ts
+++ b/frontend/src/hooks/api/dashboard/types.ts
@@ -243,6 +243,7 @@ export type TGetDashboardProjectSecretsByKeys = {
environment: string;
keys: string[];
viewSecretValue?: boolean;
+ hideUnreadableValues?: boolean;
};
export type TGetAccessibleSecretsDTO = {