Skip to content

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

feat: corrected dummy column in overview and main page

=6158b8a91da6
diff --git a/backend/src/ee/services/secret-approval-request/secret-approval-request-service.ts b/backend/src/ee/services/secret-approval-request/secret-approval-request-service.ts
index 1cd8b68b5e..1b960ab335 100644
--- a/backend/src/ee/services/secret-approval-request/secret-approval-request-service.ts
+++ b/backend/src/ee/services/secret-approval-request/secret-approval-request-service.ts
@@ -1301,7 +1301,7 @@ export const secretApprovalRequestServiceFactory = ({
environment,
secretPath,
secretName: commit.key,
- secretTags: commitTagIds[commit.key].map((secretTagId) => tagsGroupById[secretTagId][0].slug)
+ secretTags: commitTagIds?.[commit.key]?.map((secretTagId) => tagsGroupById[secretTagId][0].slug)
})
);
});
diff --git a/backend/src/ee/services/secret-rotation/secret-rotation-service.ts b/backend/src/ee/services/secret-rotation/secret-rotation-service.ts
index 4c3c61b0c0..9eadca32b0 100644
--- a/backend/src/ee/services/secret-rotation/secret-rotation-service.ts
+++ b/backend/src/ee/services/secret-rotation/secret-rotation-service.ts
@@ -1,7 +1,7 @@
import { ForbiddenError, subject } from "@casl/ability";
import Ajv from "ajv";
-import { ProjectVersion } from "@app/db/schemas";
+import { ProjectVersion, TableName } from "@app/db/schemas";
import { decryptSymmetric128BitHexKeyUTF8, infisicalSymmetricEncypt } from "@app/lib/crypto/encryption";
import { BadRequestError, NotFoundError } from "@app/lib/errors";
import { TProjectPermission } from "@app/lib/types";
@@ -106,7 +106,7 @@ export const secretRotationServiceFactory = ({
if (shouldUseBridge) {
const selectedSecrets = await secretV2BridgeDAL.find({
folderId: folder.id,
- $in: { id: Object.values(outputs) }
+ $in: { [`${TableName.SecretV2}.id` as "id"]: Object.values(outputs) }
});
if (selectedSecrets.length !== Object.values(outputs).length)
throw new NotFoundError({ message: "Secrets not found" });
diff --git a/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts b/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts
index 821ac1e008..5d715bbc0e 100644
--- a/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts
+++ b/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts
@@ -1,7 +1,7 @@
import { ForbiddenError, PureAbility, subject } from "@casl/ability";
import { z } from "zod";
-import { ProjectMembershipRole, SecretsV2Schema, SecretType } from "@app/db/schemas";
+import { ProjectMembershipRole, SecretsV2Schema, SecretType, TableName } from "@app/db/schemas";
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
import { ProjectPermissionActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";
import { TSecretApprovalPolicyServiceFactory } from "@app/ee/services/secret-approval-policy/secret-approval-policy-service";
@@ -1617,7 +1617,7 @@ export const secretV2BridgeServiceFactory = ({
const sourceSecrets = await secretDAL.find({
type: SecretType.Shared,
$in: {
- id: secretIds
+ [`${TableName.SecretV2}.id` as "id"]: secretIds
}
});
sourceSecrets.forEach((secret) => {
diff --git a/frontend/src/hooks/api/dashboard/queries.tsx b/frontend/src/hooks/api/dashboard/queries.tsx
index 29fcbe8950..ec018e953d 100644
--- a/frontend/src/hooks/api/dashboard/queries.tsx
+++ b/frontend/src/hooks/api/dashboard/queries.tsx
@@ -15,6 +15,7 @@ import {
} from "@app/hooks/api/dashboard/types";
import { OrderByDirection } from "@app/hooks/api/generic/types";
import { mergePersonalSecrets } from "@app/hooks/api/secrets/queries";
+import { unique } from "@app/lib/fn/array";
export const dashboardKeys = {
all: () => ["dashboard"] as const,
@@ -154,10 +155,24 @@ export const useGetProjectSecretsOverview = (
},
select: useCallback((data: Awaited<ReturnType<typeof fetchProjectSecretsOverview>>) => {
const { secrets, ...select } = data;
+ const uniqueSecrets = secrets
+ ? unique(secrets, (i) => `${i.secretKey}:${i.environment}`)
+ : [];
+
+ const uniqueFolders = select.folders
+ ? unique(select.folders, (i) => `${i.name}:${i.environment}`)
+ : [];
+
+ const uniqueDynamicSecrets = select.dynamicSecrets
+ ? unique(select.dynamicSecrets, (i) => `${i.name}:${i.environment}`)
+ : [];
return {
...select,
- secrets: secrets ? mergePersonalSecrets(secrets) : undefined
+ secrets: secrets ? mergePersonalSecrets(secrets) : undefined,
+ totalUniqueSecretsInPage: uniqueSecrets.length,
+ totalUniqueDynamicSecretsInPage: uniqueDynamicSecrets.length,
+ totalUniqueFoldersInPage: uniqueFolders.length
};
}, []),
keepPreviousData: true
diff --git a/frontend/src/hooks/api/dashboard/types.ts b/frontend/src/hooks/api/dashboard/types.ts
index 08e75ee3b5..865d8541de 100644
--- a/frontend/src/hooks/api/dashboard/types.ts
+++ b/frontend/src/hooks/api/dashboard/types.ts
@@ -12,6 +12,9 @@ export type DashboardProjectSecretsOverviewResponse = {
totalFolderCount?: number;
totalDynamicSecretCount?: number;
totalCount: number;
+ totalUniqueSecretsInPage: number;
+ totalUniqueDynamicSecretsInPage: number;
+ totalUniqueFoldersInPage: number;
};
export type DashboardProjectSecretsDetailsResponse = {
diff --git a/frontend/src/lib/fn/array.ts b/frontend/src/lib/fn/array.ts
index b923906972..eef80a892a 100644
--- a/frontend/src/lib/fn/array.ts
+++ b/frontend/src/lib/fn/array.ts
@@ -13,3 +13,22 @@ export const groupBy = <T, Key extends string | number | symbol>(
acc[groupId].push(item);
return acc;
}, {} as Record<Key, T[]>);
+
+/**
+ * Given a list of items returns a new list with only
+ * unique items. Accepts an optional identity function
+ * to convert each item in the list to a comparable identity
+ * value
+ */
+export const unique = <T, K extends string | number | symbol>(
+ array: readonly T[],
+ toKey?: (item: T) => K
+): T[] => {
+ const valueMap = array.reduce((acc, item) => {
+ const key = toKey ? toKey(item) : (item as unknown as string | number | symbol);
+ if (acc[key]) return acc;
+ acc[key] = item;
+ return acc;
+ }, {} as Record<string | number | symbol, T>);
+ return Object.values(valueMap);
+};
diff --git a/frontend/src/views/SecretMainPage/SecretMainPage.tsx b/frontend/src/views/SecretMainPage/SecretMainPage.tsx
index 43608444ee..6c51584dca 100644
--- a/frontend/src/views/SecretMainPage/SecretMainPage.tsx
+++ b/frontend/src/views/SecretMainPage/SecretMainPage.tsx
@@ -409,6 +409,7 @@ export const SecretMainPage = () => {
<SecretNoAccessListView
count={Math.max(
(page * perPage > totalCount ? totalCount % perPage : perPage) -
+ (imports?.length || 0) -
(folders?.length || 0) -
(secrets?.length || 0) -
(dynamicSecrets?.length || 0),
diff --git a/frontend/src/views/SecretOverviewPage/SecretOverviewPage.tsx b/frontend/src/views/SecretOverviewPage/SecretOverviewPage.tsx
index 652fac1cf6..57773220da 100644
--- a/frontend/src/views/SecretOverviewPage/SecretOverviewPage.tsx
+++ b/frontend/src/views/SecretOverviewPage/SecretOverviewPage.tsx
@@ -71,7 +71,10 @@ import { SecretType, TSecretFolder } from "@app/hooks/api/types";
import { ProjectVersion } from "@app/hooks/api/workspace/types";
import { useDynamicSecretOverview, useFolderOverview, useSecretOverview } from "@app/hooks/utils";
import { SecretOverviewDynamicSecretRow } from "@app/views/SecretOverviewPage/components/SecretOverviewDynamicSecretRow";
-import { SecretOverviewTableRow } from "@app/views/SecretOverviewPage/components/SecretOverviewTableRow";
+import {
+ SecretNoAccessOverviewTableRow,
+ SecretOverviewTableRow
+} from "@app/views/SecretOverviewPage/components/SecretOverviewTableRow";
import { SecretTableResourceCount } from "@app/views/SecretOverviewPage/components/SecretTableResourceCount";
import { FolderForm } from "../SecretMainPage/components/ActionBar/FolderForm";
@@ -239,7 +242,10 @@ export const SecretOverviewPage = () => {
totalFolderCount,
totalSecretCount,
totalDynamicSecretCount,
- totalCount = 0
+ totalCount = 0,
+ totalUniqueFoldersInPage,
+ totalUniqueSecretsInPage,
+ totalUniqueDynamicSecretsInPage
} = overview ?? {};
useEffect(() => {
@@ -968,6 +974,16 @@ export const SecretOverviewPage = () => {
expandableColWidth={expandableTableWidth}
/>
))}
+ <SecretNoAccessOverviewTableRow
+ environments={visibleEnvs}
+ count={Math.max(
+ (page * perPage > totalCount ? totalCount % perPage : perPage) -
+ (totalUniqueFoldersInPage || 0) -
+ (totalUniqueDynamicSecretsInPage || 0) -
+ (totalUniqueSecretsInPage || 0),
+ 0
+ )}
+ />
</>
)}
</TBody>