diegosouzapw/OmniRoute · error · Error

Remote image host could not be resolved (blocked)

Error message

Remote image host could not be resolved (blocked)

What it means

Thrown by assertHostnameResolvesPublic() in public-only guard mode when DNS lookup of the remote image hostname fails (the `lookup` call rejects). The host is treated as blocked because its addresses cannot be verified as public — this is the DNS-failure branch of the SSRF/DNS-rebinding defense.

Solutions

  1. Fix DNS for the image hostname (NXDOMAIN/timeout on the resolver)
  2. Verify the hostname is correct and publicly resolvable
  3. Check the host's DNS/network from the server running the proxy
  4. If the image URL is a bare IP, ensure it is a valid public IP — invalid literals also fail this check
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/shared/network/remoteImageFetch.ts:83 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/8a784e86bca473c7. Report an issue: GitHub.

Appendix: source

Thrown at src/shared/network/remoteImageFetch.ts:83

/** Resolve every answer, reject the host if any answer is private, then return
 * the validated addresses so the caller can bind the connection to one of them. */
async function assertHostnameResolvesPublic(
  url: URL,
  guard: OutboundUrlGuardMode,
  lookup: RemoteImageLookup
): Promise<Array<{ address: string; family: number }>> {
  if (guard !== "public-only") return [];
  const hostname = url.hostname;
  const bare =
    hostname.startsWith("[") && hostname.endsWith("]") ? hostname.slice(1, -1) : hostname;
  if (!bare) return [];
  if (isIP(bare)) return [{ address: bare, family: isIP(bare) }];
  let resolved: Array<{ address: string; family: number }>;
  try {
    resolved = await lookup(bare);
  } catch {
    throw new Error("Remote image host could not be resolved (blocked)");
  }
  if (!resolved.length) {
    throw new Error("Remote image host could not be resolved (blocked)");
  }
  for (const { address } of resolved) {
    if (isPrivateHost(address)) {
      throw new Error("Remote image host resolves to a blocked private address (DNS rebinding)");
    }
  }
  return resolved;
}
/**
 * Build a `fetch` bound to a single already-DNS-validated address, ignoring
 * whatever the hostname resolves to at connect time. Exported for direct
 * testing: this is the mechanism that closes the DNS-rebinding TOCTOU gap
 * (GHSA-cmhj-wh2f-9cgx) — a second, real DNS lookup at connect time could
 * otherwise return a different (possibly private) address than the one
 * `assertHostnameResolvesPublic` validated.

View on GitHub (pinned to a179ffed5b)