Skip to content

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

fix(ldap-auth): remove unnecessary whitespace trimming for LDAP fields and ensure required validation for URL, bind DN, and search base

Victor Hugo dos Santosa2dfa5b6781e
diff --git a/backend/src/ee/services/identity-auth-template/identity-auth-template-schemas.ts b/backend/src/ee/services/identity-auth-template/identity-auth-template-schemas.ts
index bdafa57f96..5b59e5a214 100644
--- a/backend/src/ee/services/identity-auth-template/identity-auth-template-schemas.ts
+++ b/backend/src/ee/services/identity-auth-template/identity-auth-template-schemas.ts
@@ -10,10 +10,10 @@ import { formatOidcAudiences } from "@app/services/identity-oidc-auth/identity-o
import { TEMPLATE_VALIDATION_MESSAGES } from "./identity-auth-template-enums";
export const ldapTemplateFieldsSchema = z.object({
- url: z.string().trim().min(1, TEMPLATE_VALIDATION_MESSAGES.LDAP.URL_REQUIRED),
- bindDN: z.string().trim().min(1, TEMPLATE_VALIDATION_MESSAGES.LDAP.BIND_DN_REQUIRED),
+ url: z.string().min(1, TEMPLATE_VALIDATION_MESSAGES.LDAP.URL_REQUIRED),
+ bindDN: z.string().min(1, TEMPLATE_VALIDATION_MESSAGES.LDAP.BIND_DN_REQUIRED),
bindPass: z.string().min(1, TEMPLATE_VALIDATION_MESSAGES.LDAP.BIND_PASSWORD_REQUIRED),
- searchBase: z.string().trim().min(1, TEMPLATE_VALIDATION_MESSAGES.LDAP.SEARCH_BASE_REQUIRED),
+ searchBase: z.string().min(1, TEMPLATE_VALIDATION_MESSAGES.LDAP.SEARCH_BASE_REQUIRED),
ldapCaCertificate: z.string().trim().optional()
});
@@ -123,9 +123,6 @@ export const ldapTemplateFieldsResponseSchema = ldapTemplateFieldsSchema
.omit({ bindPass: true })
.partial()
.extend({
- url: z.string().optional(),
- bindDN: z.string().optional(),
- searchBase: z.string().optional(),
hasBindPass: z.boolean().describe("Whether a bind password is stored for this template")
});