{"record":{"id":"8a784e86bca473c7","repo":"diegosouzapw/OmniRoute","slug":"remote-image-host-could-not-be-resolved-blocked","errorCode":null,"errorMessage":"Remote image host could not be resolved (blocked)","messagePattern":"Remote image host could not be resolved \\(blocked\\)","errorType":"error_code","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/shared/network/remoteImageFetch.ts","lineNumber":83,"sourceCode":"\n/** Resolve every answer, reject the host if any answer is private, then return\n * the validated addresses so the caller can bind the connection to one of them. */\nasync function assertHostnameResolvesPublic(\n  url: URL,\n  guard: OutboundUrlGuardMode,\n  lookup: RemoteImageLookup\n): Promise<Array<{ address: string; family: number }>> {\n  if (guard !== \"public-only\") return [];\n  const hostname = url.hostname;\n  const bare =\n    hostname.startsWith(\"[\") && hostname.endsWith(\"]\") ? hostname.slice(1, -1) : hostname;\n  if (!bare) return [];\n  if (isIP(bare)) return [{ address: bare, family: isIP(bare) }];\n  let resolved: Array<{ address: string; family: number }>;\n  try {\n    resolved = await lookup(bare);\n  } catch {\n    throw new Error(\"Remote image host could not be resolved (blocked)\");\n  }\n  if (!resolved.length) {\n    throw new Error(\"Remote image host could not be resolved (blocked)\");\n  }\n  for (const { address } of resolved) {\n    if (isPrivateHost(address)) {\n      throw new Error(\"Remote image host resolves to a blocked private address (DNS rebinding)\");\n    }\n  }\n  return resolved;\n}\n/**\n * Build a `fetch` bound to a single already-DNS-validated address, ignoring\n * whatever the hostname resolves to at connect time. Exported for direct\n * testing: this is the mechanism that closes the DNS-rebinding TOCTOU gap\n * (GHSA-cmhj-wh2f-9cgx) — a second, real DNS lookup at connect time could\n * otherwise return a different (possibly private) address than the one\n * `assertHostnameResolvesPublic` validated.","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/shared/network/remoteImageFetch.ts#L65-L101","documentation":"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.","triggerScenarios":"Thrown at src/shared/network/remoteImageFetch.ts:83 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix DNS for the image hostname (NXDOMAIN/timeout on the resolver)","Verify the hostname is correct and publicly resolvable","Check the host's DNS/network from the server running the proxy","If the image URL is a bare IP, ensure it is a valid public IP — invalid literals also fail this check"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}