Skip to content

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

keep old min behavior

Thiago Araujo da Silva3b6663d94c13
diff --git a/backend/src/server/routes/v1/identity-router.ts b/backend/src/server/routes/v1/identity-router.ts
index c551bebbf6..c3e6c03b49 100644
--- a/backend/src/server/routes/v1/identity-router.ts
+++ b/backend/src/server/routes/v1/identity-router.ts
@@ -47,7 +47,7 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
}
],
body: z.object({
- name: auditSafeText(z.string().trim().min(1).max(255)).describe(IDENTITIES.CREATE.name),
+ name: auditSafeText(z.string().trim().max(255)).describe(IDENTITIES.CREATE.name),
organizationId: z.string().trim().describe(IDENTITIES.CREATE.organizationId),
role: z.string().trim().min(1).default(OrgMembershipRole.NoAccess).describe(IDENTITIES.CREATE.role),
hasDeleteProtection: z.boolean().default(false).describe(IDENTITIES.CREATE.hasDeleteProtection),
diff --git a/backend/src/services/identity/identity-service.test.ts b/backend/src/services/identity/identity-service.test.ts
index 3122c3c57e..764eb9b35e 100644
--- a/backend/src/services/identity/identity-service.test.ts
+++ b/backend/src/services/identity/identity-service.test.ts
@@ -222,12 +222,10 @@ describe("updateIdentity name check", () => {
expect(identityDAL.updateById).toHaveBeenCalledWith(IDENTITY_ID, { name: "", hasDeleteProtection: true }, TX);
});
- test("a rename to an empty name is refused", async () => {
+ test("an empty name on its own is ignored, as before", async () => {
const { service, identityDAL } = createService();
- await expect(service.updateIdentity({ ...buildDto(), name: "" } as never)).rejects.toThrow(
- "Identity name cannot be empty"
- );
+ await service.updateIdentity({ ...buildDto(), name: "" } as never);
expect(identityDAL.updateById).not.toHaveBeenCalled();
});
diff --git a/backend/src/services/identity/identity-service.ts b/backend/src/services/identity/identity-service.ts
index 67268a7307..01f96bb169 100644
--- a/backend/src/services/identity/identity-service.ts
+++ b/backend/src/services/identity/identity-service.ts
@@ -295,9 +295,8 @@ export const identityServiceFactory = ({
throw new BadRequestError({ message: `Identity is managed by project` });
}
- if (name !== undefined && name !== identityDetails.name) {
- if (!name) throw new BadRequestError({ message: "Identity name cannot be empty" });
- if (containsLogUnsafeCharacters(name)) throw new BadRequestError({ message: LOG_UNSAFE_TEXT_MESSAGE });
+ if (name && name !== identityDetails.name && containsLogUnsafeCharacters(name)) {
+ throw new BadRequestError({ message: LOG_UNSAFE_TEXT_MESSAGE });
}
const identity = await identityDAL.transaction(async (tx) => {