Skip to content

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

fix(ldap): refine referral domain validation in buildReferralUrl function

Victor Hugo dos Santos63a8aeaf5db6
diff --git a/backend/src/services/app-connection/ldap/ldap-connection-fns.ts b/backend/src/services/app-connection/ldap/ldap-connection-fns.ts
index 44ade944ea..8e9d1aa96e 100644
--- a/backend/src/services/app-connection/ldap/ldap-connection-fns.ts
+++ b/backend/src/services/app-connection/ldap/ldap-connection-fns.ts
@@ -84,7 +84,7 @@ export const buildReferralUrl = (originalUrl: string, targetDomain: string): str
const originalRoot = getRootDomain(host);
const targetRoot = getRootDomain(targetDomain);
- if (originalRoot && targetRoot && originalRoot !== targetRoot) {
+ if (originalRoot && (!targetRoot || originalRoot !== targetRoot)) {
throw new Error(
`Referral domain '${targetDomain}' is outside the trust boundary of '${host}' — refusing to forward credentials`
);