Skip to content

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

feat: resolved identity filtering with blur

=2e64f37a2d1e
diff --git a/backend/src/services/identity-project/identity-project-service.ts b/backend/src/services/identity-project/identity-project-service.ts
index abe0446da6..15d94c684a 100644
--- a/backend/src/services/identity-project/identity-project-service.ts
+++ b/backend/src/services/identity-project/identity-project-service.ts
@@ -60,8 +60,14 @@ export const identityProjectServiceFactory = ({
});
const totalCount = await identityProjectDAL.getCountByProjectId(projectId, { search });
+ const filteredMemberships = identityMemberships.filter((el) =>
+ permission.can(
+ ProjectPermissionIdentityActions.Read,
+ subject(ProjectPermissionSub.Identity, { identityId: el.id })
+ )
+ );
- return { identityMemberships, totalCount };
+ return { identityMemberships: filteredMemberships, totalCount };
};
const getProjectIdentityByIdentityId = async ({
diff --git a/backend/src/services/membership-identity/membership-identity-service.ts b/backend/src/services/membership-identity/membership-identity-service.ts
index 224dff67b1..ab63c45081 100644
--- a/backend/src/services/membership-identity/membership-identity-service.ts
+++ b/backend/src/services/membership-identity/membership-identity-service.ts
@@ -299,7 +299,7 @@ export const membershipIdentityServiceFactory = ({
const { scopeData } = dto;
const factory = scopeFactory[scopeData.scope];
- await factory.onListMembershipIdentityGuard(dto);
+ const listFilter = await factory.onListMembershipIdentityGuard(dto);
const memberships = await membershipIdentityDAL.findIdentities({
scopeData,
filter: {
@@ -317,7 +317,7 @@ export const membershipIdentityServiceFactory = ({
: undefined
}
});
- return memberships;
+ return { ...memberships, data: memberships.data.filter((el) => listFilter({ identityId: el.identity.id })) };
};
const getMembershipByIdentityId = async (dto: TGetMembershipIdentityByIdentityIdDTO) => {
diff --git a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx
index 56d03e6fc5..61d48c52d6 100644
--- a/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/IdentityTab/IdentityTab.tsx
@@ -79,6 +79,7 @@ import { usePopUp } from "@app/hooks/usePopUp";
import { ProjectIdentityModal } from "@app/pages/project/AccessControlPage/components/IdentityTab/components/ProjectIdentityModal";
import { ProjectLinkIdentityModal } from "./components/ProjectLinkIdentityModal";
+import { Blur } from "@app/components/v2/Blur";
const MAX_ROLES_TO_BE_SHOWN_IN_TABLE = 2;
@@ -174,7 +175,6 @@ export const IdentityTab = withProjectPermission(
handlePopUpClose("deleteIdentity");
};
-
const handleSort = (column: ProjectIdentityOrderBy) => {
if (column === orderBy) {
setOrderDirection((prev) =>
@@ -187,6 +187,12 @@ export const IdentityTab = withProjectPermission(
setOrderDirection(OrderByDirection.ASC);
};
+ const noAccessIdentityCount = Math.max(
+ (page * perPage > totalCount ? totalCount % perPage : perPage) -
+ (data?.identityMemberships?.length || 0),
+ 0
+ );
+
return (
<div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
<div className="mb-4 flex items-center justify-between">
@@ -450,6 +456,20 @@ export const IdentityTab = withProjectPermission(
</Tr>
);
})}
+ {!isPending &&
+ data &&
+ data?.totalCount !== 0 &&
+ Array.from(Array(noAccessIdentityCount)).map((_e, i) => (
+ <Tr key={`hid-identity-${i + 1}`}>
+ <Td>No Access</Td>
+ <Td colSpan={3}>
+ <Blur
+ className="w-min"
+ tooltipText="You do not have permission to read this identity."
+ />
+ </Td>
+ </Tr>
+ ))}
</TBody>
</Table>
{!isPending && data && totalCount > 0 && (
@@ -461,16 +481,19 @@ export const IdentityTab = withProjectPermission(
onChangePerPage={handlePerPageChange}
/>
)}
- {!isPending && data && data?.identityMemberships.length === 0 && (
- <EmptyState
- title={
- debouncedSearch.trim().length > 0
- ? "No identities match search filter"
- : "No identities have been added to this project"
- }
- icon={faServer}
- />
- )}
+ {!isPending &&
+ data &&
+ data?.identityMemberships.length === 0 &&
+ data?.totalCount === 0 && (
+ <EmptyState
+ title={
+ debouncedSearch.trim().length > 0
+ ? "No identities match search filter"
+ : "No identities have been added to this project"
+ }
+ icon={faServer}
+ />
+ )}
</TableContainer>
<Modal
isOpen={popUp.createIdentity.isOpen}