{"record":{"id":"dbe81eaf06b0cccd","repo":"jeecgboot/JeecgBoot","slug":"error-dbe81e","errorCode":null,"errorMessage":"原始接口路径不能以 // 或 /\\ 开头","messagePattern":"原始接口路径不能以 // 或 /\\\\ 开头","errorType":"validation","errorClass":"JeecgBootBizTipException","httpStatus":null,"severity":"warning","filePath":"jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/openapi/controller/OpenApiController.java","lineNumber":269,"sourceCode":"        }\n        String decoded;\n        try {\n            decoded = java.net.URLDecoder.decode(originUrl, \"UTF-8\");\n            // 二次解码，防止 %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    }","sourceCodeStart":251,"sourceCodeEnd":287,"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#L251-L287","documentation":"Thrown when a relative originUrl begins with '//' or '/\\'. These prefixes are blocked because '//host' is treated by browsers/proxies as a protocol-relative URL (causing SSRF or off-host routing) and '/\\' can be normalized to '\\\\host' on Windows-style path parsers.","triggerScenarios":"Configuring origin_url as '//internal-service/x', '/\\\\evil.com\\path', or a value that double-decodes to one of these prefixes.","commonSituations":"Copy-paste from a protocol-relative URL; attackers testing SSRF; values that survive double-decoding into a leading '//' from '%2f%2f' or '%252f%252f'.","solutions":["Use a single leading slash for relative paths: '/path', not '//path'.","If you genuinely need to target another host, use the full 'http(s)://host/path' form.","Audit the stored origin_url in the database for any leading '//' introduced by upstream encoding."],"exampleFix":"// before: originUrl = \"//erp-service:7003/api\"\n// after:  originUrl = \"http://erp-service:7003/api\"","handlingStrategy":"validation","validationCode":"// Reject protocol-relative or backslash-relative prefixes\nif (originUrl != null && (originUrl.startsWith(\"//\") || originUrl.startsWith(\"/\\\\\"))) {\n    // block submission\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never configure '//host' protocol-relative origin URLs.","For cross-host targets use the full http(s):// form.","Treat any leading '//\\' as a SSRF red flag in code review."],"tags":["openapi","url-validation","ssrf","security"],"backgroundTag":null,"analyzedSha":"96fb33f5ec68516da0b0147da06b2eb0419e063a","analyzedAt":"2026-08-14T00:04:16.786Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}