Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix(ldap-auth): validate LDAP template fields and improve error messaging for URL changes
Victor Hugo dos Santos7b0b7b9e8204
diff --git a/backend/src/services/identity-ldap-auth/identity-ldap-auth-service.ts b/backend/src/services/identity-ldap-auth/identity-ldap-auth-service.tsindex 572a11acbe..ea85ff3a48 100644--- a/backend/src/services/identity-ldap-auth/identity-ldap-auth-service.ts+++ b/backend/src/services/identity-ldap-auth/identity-ldap-auth-service.ts@@ -452,6 +452,11 @@ export const identityLdapAuthServiceFactory = ({let ldapConfig: { bindDN: string; bindPass: string; searchBase: string; url: string; ldapCaCertificate?: string };if (template) {ldapConfig = JSON.parse(decryptor({ cipherTextBlob: template.templateFields }).toString());+ if (!ldapConfig.bindDN || !ldapConfig.bindPass || !ldapConfig.searchBase || !ldapConfig.url) {+ throw new BadRequestError({+ message: `LDAP auth template '${template.name}' is missing a bind DN, bind password, search base, or URL. Update the template before attaching it to an identity.`+ });+ }} else {if (!bindDN || !bindPass || !searchBase || !url) {throw new BadRequestError({@@ -687,10 +692,11 @@ export const identityLdapAuthServiceFactory = ({};}- if (!template && config.url && config.url !== identityLdapAuth.url && !config.bindPass) {+ if (config.url && config.url !== identityLdapAuth.url && !config.bindPass) {throw new BadRequestError({- message:- "Changing the LDAP URL requires supplying bindPass, because the stored bind password cannot be read back. Send the bind password for the new server with this change."+ message: template+ ? `LDAP auth template '${template.name}' has no bind password stored, so it cannot move this identity to a different LDAP URL. Add a bind password to the template first.`+ : "Changing the LDAP URL requires supplying bindPass, because the stored bind password cannot be read back. Send the bind password for the new server with this change."});}