Skip to content

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

fix(identity): enforce delete protection in scoped identity delete

syedmazharaliraza6349946c316e
diff --git a/backend/src/services/identity-v2/identity-service.ts b/backend/src/services/identity-v2/identity-service.ts
index cede7da822..f86fe5ebd6 100644
--- a/backend/src/services/identity-v2/identity-service.ts
+++ b/backend/src/services/identity-v2/identity-service.ts
@@ -202,6 +202,9 @@ export const identityV2ServiceFactory = ({
});
if (!existingIdentity)
throw new NotFoundError({ message: `Identity with id ${dto.selector.identityId} not found` });
+ if (existingIdentity.hasDeleteProtection) {
+ throw new BadRequestError({ message: "Identity has delete protection" });
+ }
const deletedIdentity = await identityDAL.deleteById(dto.selector.identityId);