BigPizzaV3/CodexPlusPlus · error · anyhow::Error

Base URL 不得包含用户名或密码

Error message

Base URL 不得包含用户名或密码

What it means

Thrown by validate_llm_proxy_url when the URL embeds a username or password (user:pass@host). Embedded credentials would be forwarded opaquely and often leak into logs; the offending input is the url field of the bridge payload, and the guard fires after the https scheme check.

Source

Thrown at crates/codex-plus-core/src/routes.rs:774

        None
    };

    Ok(json!({
        "status": "ok",
        "http_status": http_status,
        "ok": ok,
        "body_text": body_text,
        "body_json": body_json,
    }))
}

fn validate_llm_proxy_url(raw: &str) -> anyhow::Result<reqwest::Url> {
    let url = reqwest::Url::parse(raw.trim()).map_err(|_| anyhow::anyhow!("Base URL 格式无效"))?;
    if url.scheme() != "https" {
        anyhow::bail!("Base URL 必须使用 HTTPS");
    }
    if !url.username().is_empty() || url.password().is_some() {
        anyhow::bail!("Base URL 不得包含用户名或密码");
    }
    let host = url
        .host_str()
        .ok_or_else(|| anyhow::anyhow!("Base URL 缺少主机名"))?;
    if is_blocked_llm_proxy_host(host) {
        anyhow::bail!("Base URL 不得指向本机或私有网络");
    }
    Ok(url)
}

fn is_blocked_llm_proxy_host(host: &str) -> bool {
    let host = host
        .trim()
        .trim_start_matches('[')
        .trim_end_matches(']')
        .to_lowercase();
    if host.is_empty()
        || host == "localhost"

View on GitHub (pinned to f2074595a2)

Solutions

  1. 从 URL 中移除 userinfo,鉴权放在请求头中
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/codex-plus-core/src/routes.rs:774 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@f2074595a2 (2026-08-23). Data as JSON: /api/errors/f0f3f9f40f7ff12d. Report an issue: GitHub.