{"record":{"id":"02b414939c8bfec6","repo":"microsoft/semantic-kernel","slug":"the-request-uri-parsed-url-geturl-is-not-all","errorCode":null,"errorMessage":"The request URI '{parsed_url.geturl()}' is not allowed: DNS resolution for host '{host}' returned no addresses. The request is blocked as a precaution.","messagePattern":"The request URI '(.+?)' is not allowed: DNS resolution for host '(.+?)' returned no addresses\\. The request is blocked as a precaution\\.","errorType":"exception","errorClass":"FunctionExecutionException","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/openapi_plugin/server_url_validator.py","lineNumber":144,"sourceCode":"    base_path_with_slash = base_path if base_path.endswith(\"/\") else f\"{base_path}/\"\n    return url_path.lower().startswith(base_path_with_slash.lower())\n\n\nasync def _ensure_public_host(parsed_url: ParseResult, dns_resolver: DnsResolver | None) -> None:\n    host = parsed_url.hostname\n    if host is None:\n        raise FunctionExecutionException(f\"The request URI '{parsed_url.geturl()}' does not contain a valid host.\")\n\n    try:\n        ip_address = ipaddress.ip_address(host)\n    except ValueError:\n        addresses = await _resolve_host(host, dns_resolver)\n    else:\n        _ensure_public_address(parsed_url.geturl(), ip_address)\n        return\n\n    if not addresses:\n        raise FunctionExecutionException(\n            f\"The request URI '{parsed_url.geturl()}' is not allowed: DNS resolution for host \"\n            f\"'{host}' returned no addresses. The request is blocked as a precaution.\"\n        )\n\n    for address in addresses:\n        _ensure_public_address(parsed_url.geturl(), address)\n\n\nasync def _resolve_host(\n    host: str,\n    dns_resolver: DnsResolver | None,\n) -> list[ipaddress.IPv4Address | ipaddress.IPv6Address]:\n    try:\n        if dns_resolver:\n            resolved_addresses = await dns_resolver(host)\n            return [ipaddress.ip_address(address) for address in resolved_addresses]\n\n        loop = asyncio.get_running_loop()","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/openapi_plugin/server_url_validator.py#L126-L162","documentation":"Thrown when DNS resolution for the host succeeded but returned zero addresses. The validator treats a host that resolves to nothing as suspicious and blocks the request as a precaution against SSRF.","triggerScenarios":"A syntactically valid hostname that has no A/AAAA records (stale DNS, typo'd subdomain, a domain with only MX/CNAME records). _resolve_host returns an empty list.","commonSituations":"Domain typo; decommissioned host; split-horizon DNS returning nothing in the current environment; a custom dns_resolver returning an empty sequence.","solutions":["Verify the hostname has A/AAAA records (dig a <host> / dig aaaa <host>)","Correct the hostname typo","If using a custom dns_resolver, ensure it returns IP address strings for valid hosts","Add the trusted base URL to allowed_base_urls to bypass DNS checks once safety is confirmed"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import socket\n\ndef host_has_records(host: str) -> bool:\n    try:\n        return len(socket.getaddrinfo(host, None, type=socket.SOCK_STREAM)) > 0\n    except OSError:\n        return False\n\nif not host_has_records(urlparse(url).hostname):\n    raise ValueError(f'{url} resolves to no addresses')","typeGuard":null,"tryCatchPattern":"try:\n    await validate_server_url(url, options)\nexcept FunctionExecutionException as e:\n    if 'returned no addresses' in str(e):\n        # verify DNS records exist or add the host to allowed_base_urls\n        ...","preventionTips":["Verify hosts have A/AAAA records before relying on them","For custom dns_resolver, ensure it returns addresses for valid hosts","Add trusted hosts to allowed_base_urls to bypass DNS checks"],"tags":["dns","network","ssrf","url-validation"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}