iflytek/astron-agent · error · BusinessException

MODEL_URL_CHECK_FAILED

MODEL_URL_CHECK_FAILED

Error message

MODEL_URL_CHECK_FAILED

What it means

validateUrlParam throws MODEL_URL_CHECK_FAILED when the URL's host is denied by the IP policy: after DNS resolution (via Dns.SYSTEM) the resolved IP hits the configured blacklist (props.getIpBlaklist()) or fails the whitelist. This blocks SSRF attempts to internal addresses.

Solutions

  1. Inspect the model URL's resolved IPs (dig/nslookup) and confirm none are internal/blacklisted.
  2. Use a public routable hostname for the model endpoint instead of localhost/internal IPs.
  3. If the endpoint is legitimately internal, add its IP to props.getIpWhitelist() — after a security review.
  4. Review props.getIpBlaklist() for recent entries that may now cover the target.

Example fix

// before
props.setModelUrl("http://127.0.0.1:8080/v1/chat");
// after
props.setModelUrl("https://models.example.com/v1/chat");
Defensive patterns

Strategy: validation

Validate before calling

InetAddress[] addrs = InetAddress.getAllByName(host);
for (InetAddress a : addrs) {
    if (a.isLoopbackAddress() || a.isSiteLocalAddress() || a.isLinkLocalAddress()) {
        throw new IllegalArgumentException("Host resolves to internal IP: " + a.getHostAddress());
    }
}

Try / catch

try {
    ssrfParamGuard.validateUrlParam(url);
} catch (BusinessException e) {
    if (ResponseEnum.MODEL_URL_CHECK_FAILED.equals(e.getCode())) {
        log.warn("Host resolves to denied IP for URL {}", sanitize(url));
    }
    throw e;
}

Prevention

When it happens

Trigger: buildModelApiUrlNew/validateSsrfForNodes receives a URL whose hostname resolves to a blacklisted IP (e.g. 127.0.0.1, 169.254.169.254 metadata IP, RFC1918 internal addresses) or is otherwise excluded by the whitelist.

Common situations: Model endpoint pointed at localhost or an internal service IP, a hostname that resolves to a private IP inside the cluster, cloud metadata endpoint URLs, or a recently added IP to the blacklist that a legitimate endpoint now resolves to.

Understand the failure class

Background: Path traversal blocked: "path escapes the workspace" and "outside site root" errors when a path will not stay inside its allowed directory — this error's family across 26 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/64b5536feb390b55. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/util/ssrf/SsrfParamGuard.java:69

        try {
            SsrfValidators.Normalized n = SsrfValidators.normalizeFlex(url);
            URL u = n.effectiveUrl;

            // 1) Protocol and port
            if (!SsrfValidators.isAllowedScheme(u.getProtocol(), props.getAllowedSchemes())) {
                throw new BusinessException(ResponseEnum.MODEL_URL_ILLEGAL_FAILED);
            }
            if (!SsrfValidators.isAllowedScheme(u.getProtocol(), props.getAllowedSchemes())) {
                throw new BusinessException(
                        ResponseEnum.RESPONSE_FAILED,
                        "Only allowed schemes: " + props.getAllowedSchemes());
            }

            // 2) IP blacklist (compatible with hostnames and IPs)
            List<String> ipBlacklist = props.getIpBlaklist();
            if (SsrfValidators.isHostDeniedByIpPolicy(
                    u.getHost(), ipBlacklist, props.getIpWhitelist(), Dns.SYSTEM)) {
                throw new BusinessException(ResponseEnum.MODEL_URL_CHECK_FAILED);
            }

        } catch (BusinessException e) {
            throw e;
        } catch (Exception e) {
            log.error("[SSRF] URL validation failed", e);
            throw new BusinessException(ResponseEnum.MODEL_URL_ILLEGAL_FAILED);
        }
    }
}

View on GitHub (pinned to 5e758547a8)