{"record":{"id":"64b5536feb390b55","repo":"iflytek/astron-agent","slug":"model-url-check-failed-64b553","errorCode":"MODEL_URL_CHECK_FAILED","errorMessage":"MODEL_URL_CHECK_FAILED","messagePattern":"MODEL_URL_CHECK_FAILED","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/util/ssrf/SsrfParamGuard.java","lineNumber":69,"sourceCode":"        try {\n            SsrfValidators.Normalized n = SsrfValidators.normalizeFlex(url);\n            URL u = n.effectiveUrl;\n\n            // 1) Protocol and port\n            if (!SsrfValidators.isAllowedScheme(u.getProtocol(), props.getAllowedSchemes())) {\n                throw new BusinessException(ResponseEnum.MODEL_URL_ILLEGAL_FAILED);\n            }\n            if (!SsrfValidators.isAllowedScheme(u.getProtocol(), props.getAllowedSchemes())) {\n                throw new BusinessException(\n                        ResponseEnum.RESPONSE_FAILED,\n                        \"Only allowed schemes: \" + props.getAllowedSchemes());\n            }\n\n            // 2) IP blacklist (compatible with hostnames and IPs)\n            List<String> ipBlacklist = props.getIpBlaklist();\n            if (SsrfValidators.isHostDeniedByIpPolicy(\n                    u.getHost(), ipBlacklist, props.getIpWhitelist(), Dns.SYSTEM)) {\n                throw new BusinessException(ResponseEnum.MODEL_URL_CHECK_FAILED);\n            }\n\n        } catch (BusinessException e) {\n            throw e;\n        } catch (Exception e) {\n            log.error(\"[SSRF] URL validation failed\", e);\n            throw new BusinessException(ResponseEnum.MODEL_URL_ILLEGAL_FAILED);\n        }\n    }\n}\n","sourceCodeStart":51,"sourceCodeEnd":80,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/util/ssrf/SsrfParamGuard.java#L51-L80","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the model URL's resolved IPs (dig/nslookup) and confirm none are internal/blacklisted.","Use a public routable hostname for the model endpoint instead of localhost/internal IPs.","If the endpoint is legitimately internal, add its IP to props.getIpWhitelist() — after a security review.","Review props.getIpBlaklist() for recent entries that may now cover the target."],"exampleFix":"// before\nprops.setModelUrl(\"http://127.0.0.1:8080/v1/chat\");\n// after\nprops.setModelUrl(\"https://models.example.com/v1/chat\");","handlingStrategy":"validation","validationCode":"InetAddress[] addrs = InetAddress.getAllByName(host);\nfor (InetAddress a : addrs) {\n    if (a.isLoopbackAddress() || a.isSiteLocalAddress() || a.isLinkLocalAddress()) {\n        throw new IllegalArgumentException(\"Host resolves to internal IP: \" + a.getHostAddress());\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    ssrfParamGuard.validateUrlParam(url);\n} catch (BusinessException e) {\n    if (ResponseEnum.MODEL_URL_CHECK_FAILED.equals(e.getCode())) {\n        log.warn(\"Host resolves to denied IP for URL {}\", sanitize(url));\n    }\n    throw e;\n}","preventionTips":["Never point model endpoints at localhost or cloud metadata IPs.","Maintain the IP whitelist deliberately and review changes.","Monitor DNS changes for model hostnames."],"tags":["security","ssrf","dns","network"],"backgroundTag":"path-traversal-blocked","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}