Skip to content

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

fix: use dns lookup as fallback for dns resolve

Scott Wilsond28c87ee6732
diff --git a/backend/src/ee/services/dynamic-secret/dynamic-secret-fns.ts b/backend/src/ee/services/dynamic-secret/dynamic-secret-fns.ts
index 05d4922401..ed4ebc45f0 100644
--- a/backend/src/ee/services/dynamic-secret/dynamic-secret-fns.ts
+++ b/backend/src/ee/services/dynamic-secret/dynamic-secret-fns.ts
@@ -24,8 +24,13 @@ export const verifyHostInputValidity = async (host: string, isGateway = false) =
if (net.isIPv4(el)) {
exclusiveIps.push(el);
} else {
- const resolvedIps = await dns.resolve4(el);
- exclusiveIps.push(...resolvedIps);
+ try {
+ const resolvedIps = await dns.resolve4(el);
+ exclusiveIps.push(...resolvedIps);
+ } catch {
+ const resolvedIps = (await dns.lookup(el, { all: true })).map(({ address }) => address);
+ exclusiveIps.push(...resolvedIps);
+ }
}
}
}
@@ -38,8 +43,13 @@ export const verifyHostInputValidity = async (host: string, isGateway = false) =
if (normalizedHost === "localhost" || normalizedHost === "host.docker.internal") {
throw new BadRequestError({ message: "Invalid db host" });
}
- const resolvedIps = await dns.resolve4(host);
- inputHostIps.push(...resolvedIps);
+ try {
+ const resolvedIps = await dns.resolve4(host);
+ inputHostIps.push(...resolvedIps);
+ } catch {
+ const resolvedIps = (await dns.lookup(host, { all: true })).map(({ address }) => address);
+ inputHostIps.push(...resolvedIps);
+ }
}
if (!isGateway && !(appCfg.DYNAMIC_SECRET_ALLOW_INTERNAL_IP || appCfg.ALLOW_INTERNAL_IP_CONNECTIONS)) {