Skip to content

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

feat: add enforceIdentityLimit flag to enforce identity limits regardless of plan

Tre Dubrava2a626c9e4730
diff --git a/backend/src/ee/services/license/license-types.ts b/backend/src/ee/services/license/license-types.ts
index 69b5e18c7f..0dc9f8d8a2 100644
--- a/backend/src/ee/services/license/license-types.ts
+++ b/backend/src/ee/services/license/license-types.ts
@@ -42,6 +42,7 @@ export type TFeatureSet = {
membersUsed: number;
identityLimit: null;
identitiesUsed: number;
+ enforceIdentityLimit?: boolean;
subOrganization: false;
environmentLimit: null;
environmentsUsed: 0;
diff --git a/backend/src/services/identity-v2/identity-service.ts b/backend/src/services/identity-v2/identity-service.ts
index 144c634e3c..9bd58e5055 100644
--- a/backend/src/services/identity-v2/identity-service.ts
+++ b/backend/src/services/identity-v2/identity-service.ts
@@ -62,8 +62,9 @@ export const identityV2ServiceFactory = ({
await factory.onCreateIdentityGuard(dto);
const plan = await licenseService.getPlan(dto.permission.orgId);
+ const isEnterpriseBypass = plan?.slug === "enterprise" && !plan?.enforceIdentityLimit;
- if (plan?.slug !== "enterprise" && plan?.identityLimit && plan.identitiesUsed >= plan.identityLimit) {
+ if (!isEnterpriseBypass && plan?.identityLimit && plan.identitiesUsed >= plan.identityLimit) {
// limit imposed on number of identities allowed / number of identities used exceeds the number of identities allowed
throw new BadRequestError({
message: "Failed to create identity due to identity limit reached. Upgrade plan to create more identities."
diff --git a/backend/src/services/identity/identity-service.ts b/backend/src/services/identity/identity-service.ts
index 00861d3ad7..04b38d6cde 100644
--- a/backend/src/services/identity/identity-service.ts
+++ b/backend/src/services/identity/identity-service.ts
@@ -129,7 +129,8 @@ export const identityServiceFactory = ({
// Check identity limit inside the transaction after acquiring the lock
// We count directly from the database to get the accurate count, not the cached plan value
const plan = await licenseService.getPlan(orgId);
- if (plan?.slug !== "enterprise" && plan?.identityLimit) {
+ const isEnterpriseBypass = plan?.slug === "enterprise" && !plan?.enforceIdentityLimit;
+ if (!isEnterpriseBypass && plan?.identityLimit) {
const currentIdentityCount = await licenseDAL.countOrgUsersAndIdentities(orgId, tx);
if (currentIdentityCount >= plan.identityLimit) {
throw new BadRequestError({