{"record":{"id":"425999b973682a9c","repo":"BigPizzaV3/CodexPlusPlus","slug":"base-url-https","errorCode":null,"errorMessage":"Base URL 必须使用 HTTPS","messagePattern":"Base URL 必须使用 HTTPS","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/routes.rs","lineNumber":787,"sourceCode":"    {\n        serde_json::from_slice::<Value>(&bytes).ok()\n    } else {\n        None\n    };\n\n    Ok(json!({\n        \"status\": \"ok\",\n        \"http_status\": http_status,\n        \"ok\": ok,\n        \"body_text\": body_text,\n        \"body_json\": body_json,\n    }))\n}\n\nfn validate_llm_proxy_url(raw: &str) -> anyhow::Result<reqwest::Url> {\n    let url = reqwest::Url::parse(raw.trim()).map_err(|_| anyhow::anyhow!(\"Base URL 格式无效\"))?;\n    if url.scheme() != \"https\" {\n        anyhow::bail!(\"Base URL 必须使用 HTTPS\");\n    }\n    if !url.username().is_empty() || url.password().is_some() {\n        anyhow::bail!(\"Base URL 不得包含用户名或密码\");\n    }\n    let host = url\n        .host_str()\n        .ok_or_else(|| anyhow::anyhow!(\"Base URL 缺少主机名\"))?;\n    if is_blocked_llm_proxy_host(host) {\n        anyhow::bail!(\"Base URL 不得指向本机或私有网络\");\n    }\n    Ok(url)\n}\n\nfn is_blocked_llm_proxy_host(host: &str) -> bool {\n    let host = host\n        .trim()\n        .trim_start_matches('[')\n        .trim_end_matches(']')","sourceCodeStart":769,"sourceCodeEnd":805,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/routes.rs#L769-L805","documentation":"validate_llm_proxy_url parses the user-supplied Base URL and requires scheme https. This is an SSRF/transport-security guard: the proxy will send the caller's body and any configured key over this URL, so plaintext http is rejected outright after URL-parse validation.","triggerScenarios":"Calling llm_proxy_value with a Base URL string whose parsed scheme is not \"https\", e.g. \"http://api.example.com\".","commonSituations":"Using a plain-HTTP local or test endpoint, forgetting the scheme entirely (\"api.example.com\" parses as a relative URL), or pasting an internal http:// address.","solutions":["Change the Base URL to https://...","Run a local HTTPS terminator (reverse proxy with TLS) if the upstream only speaks HTTP","Verify the URL string includes the scheme, e.g. \"https://host\" not \"host\""],"exampleFix":"// before\nlet url = validate_llm_proxy_url(\"http://api.openai.com/v1\")?;\n// after\nlet url = validate_llm_proxy_url(\"https://api.openai.com/v1\")?;","handlingStrategy":"validation","validationCode":"fn base_url_is_https(raw: &str) -> bool {\n    reqwest::Url::parse(raw.trim()).map(|u| u.scheme() == \"https\").unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include the https:// scheme in configured Base URLs","Validate URL scheme at config-entry time in the UI, not just at request time","Never paste scheme-less hostnames into Base URL fields"],"tags":["url","https","validation"],"backgroundTag":"invalid-url","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}