{"record":{"id":"fba7ee0b3b8357c0","repo":"jeecgboot/JeecgBoot","slug":"http-s-url-fba7ee","errorCode":null,"errorMessage":"原始接口路径仅支持相对路径或 http(s) 完整URL","messagePattern":"原始接口路径仅支持相对路径或 http\\(s\\) 完整URL","errorType":"validation","errorClass":"JeecgBootBizTipException","httpStatus":null,"severity":"error","filePath":"jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/openapi/controller/OpenApiController.java","lineNumber":273,"sourceCode":"            // 二次解码，防止 %252f 这类双重编码绕过\n            decoded = java.net.URLDecoder.decode(decoded, \"UTF-8\");\n        } catch (Exception e) {\n            throw new JeecgBootBizTipException(\"原始接口路径包含非法字符\");\n        }\n        //update-begin---author:scott ---date:20260429  for：【issues/9590】微服务nginx部署openApi接口访问不到-----------\n        // 微服务部署时，OpenAPI 配置的接口可能位于其他微服务模块（如 erp 7003），允许 originUrl 直接配置完整 http(s) URL\n        String lower = decoded.toLowerCase();\n        boolean isFullHttpUrl = lower.startsWith(\"http://\") || lower.startsWith(\"https://\");\n        if (!isFullHttpUrl) {\n            if (!decoded.startsWith(\"/\")) {\n                throw new JeecgBootBizTipException(\"原始接口路径必须以 / 开头，或填写完整的 http(s) URL\");\n            }\n            if (decoded.startsWith(\"//\") || decoded.startsWith(\"/\\\\\")) {\n                throw new JeecgBootBizTipException(\"原始接口路径不能以 // 或 /\\\\ 开头\");\n            }\n            if (lower.contains(\"://\") || lower.startsWith(\"file:\") || lower.startsWith(\"ftp:\") || lower.startsWith(\"gopher:\")\n                    || lower.startsWith(\"jar:\") || lower.startsWith(\"netdoc:\")) {\n                throw new JeecgBootBizTipException(\"原始接口路径仅支持相对路径或 http(s) 完整URL\");\n            }\n        } else {\n            // 即便是完整URL，也禁止其它危险协议（防止 http://x@file:/... 之类的绕过场景）\n            String afterScheme = lower.substring(lower.indexOf(\"://\") + 3);\n            if (afterScheme.contains(\"file:\") || afterScheme.contains(\"ftp:\") || afterScheme.contains(\"gopher:\")\n                    || afterScheme.contains(\"jar:\") || afterScheme.contains(\"netdoc:\")) {\n                throw new JeecgBootBizTipException(\"原始接口路径不允许嵌套 file/ftp/gopher/jar/netdoc 等协议\");\n            }\n        }\n        if (decoded.contains(\"..\")) {\n            throw new JeecgBootBizTipException(\"原始接口路径不能包含 ..\");\n        }\n        //update-end---author:scott ---date:20260429  for：【issues/9590】微服务nginx部署openApi接口访问不到-----------\n    }\n\n    @GetMapping(\"/json\")\n    public SwaggerModel swaggerModel() {\n","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/jeecgboot/JeecgBoot/blob/96fb33f5ec68516da0b0147da06b2eb0419e063a/jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/openapi/controller/OpenApiController.java#L255-L291","documentation":"Thrown when a non-http relative path contains a scheme separator ('://') or starts with a dangerous scheme (file:, ftp:, gopher:, jar:, netdoc:). This blocks SSRF and local-file-read attempts via the OpenAPI proxy that forwards originUrl to an upstream.","triggerScenarios":"origin_url set to 'file:///etc/passwd', 'ftp://internal/data', 'gopher://...', or a relative path that after double-decode contains '://' (e.g. '%3a%2f%2f').","commonSituations":"Security testing / penetration attempts; misconfigured import that loaded unsafe URLs; legacy data with absolute non-http URLs.","solutions":["Replace the dangerous scheme with a relative '/path' or a full 'http(s)://host/path' URL.","Search the open_api table for rows whose origin_url matches file:|ftp:|gopher:|jar:|netdoc: and correct them.","Add a client-side regex gate in the admin UI rejecting these schemes before submit."],"exampleFix":"// before: originUrl = \"file:///data/config.json\"\n// after:  originUrl = \"/sys/api/config\"","handlingStrategy":"validation","validationCode":"private static final java.util.regex.Pattern DANGEROUS =\n    java.util.regex.Pattern.compile(\"://|^(file:|ftp:|gopher:|jar:|netdoc:)\", java.util.regex.Pattern.CASE_INSENSITIVE);\nprivate static boolean isSafeRelative(String s) {\n    return s != null && s.startsWith(\"/\") && !DANGEROUS.matcher(s.toLowerCase()).find();\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat any non-http scheme in originUrl as invalid by policy.","Run a periodic scan of the open_api table for dangerous schemes.","Block these schemes at the admin-UI layer before submission."],"tags":["openapi","url-validation","ssrf","security","input-validation"],"backgroundTag":null,"analyzedSha":"96fb33f5ec68516da0b0147da06b2eb0419e063a","analyzedAt":"2026-08-14T00:04:16.786Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}