BigPizzaV3/CodexPlusPlus · error · anyhow::Error
仅支持 Codex++ 分享站点链接
Error message
仅支持 Codex++ 分享站点链接
What it means
validate_share_url enforces that the share link is https and its host is in SHARE_HOSTS (share.codexpp.cc / codexpp-share.pages.dev). Any other host — including lookalike domains — is rejected to prevent importing sessions from untrusted servers.
Solutions
- Use the official share host (share.codexpp.cc or codexpp-share.pages.dev)
- Ensure the URL is https://, not http://
- If you need a custom share host, add it to SHARE_HOSTS in session_share.rs
Example fix
// before import_shared_session_url(home, "https://my-share.example.com/s/abc#k=...")?; // after import_shared_session_url(home, "https://share.codexpp.cc/s/abc#k=...")?;
Defensive patterns
Strategy: validation
Validate before calling
fn is_official_share_url(url: &str) -> bool {
const SHARE_HOSTS: &[&str] = &["share.codexpp.cc", "codexpp-share.pages.dev"];
reqwest::Url::parse(url.trim()).map(|u| u.scheme() == "https" && u.host_str().is_some_and(|h| SHARE_HOSTS.contains(&h))).unwrap_or(false)
} Prevention
- Only distribute links from official share hosts
- Warn users when pasting non-official domains
- Keep the SHARE_HOSTS allowlist in sync with actual deployments
When it happens
Trigger: Calling save_pending_session_share_from_protocol_url, load_pending_session_share, or import_shared_session_url with a share URL hosted on any domain outside SHARE_HOSTS, or with a non-HTTPS scheme.
Common situations: Self-hosting a share page or using an alternative mirror domain; an http:// variant of the share link; a different deployment environment with its own share host.
Understand the failure class
Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.
Related errors
- API 地址须使用 HTTPS,且不含账号、密码、查询参数或片段
- API 地址须使用 HTTPS,且不含账号、密码、查询参数或片段
- Base URL 不得指向本机或私有网络
- Base URL 不得包含用户名或密码
- 主题市场资源地址越界
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/2146b2a66f99c862.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/session_share.rs:110
.fragment()
.and_then(|fragment| {
fragment
.split('&')
.find_map(|pair| pair.strip_prefix("k="))
})
.context("分享链接缺少解密密钥")?;
let plaintext = decrypt_shared_payload(encrypted, key_value)?;
let payload: Value = serde_json::from_slice(&plaintext).context("分享会话内容格式无效")?;
if payload.get("kind").and_then(Value::as_str) != Some("codex-rollout") {
bail!("当前分享内容不是可导入的 Codex rollout 会话");
}
import_rollout(home, &payload)
}
fn validate_share_url(url: &str) -> anyhow::Result<reqwest::Url> {
let parsed = reqwest::Url::parse(url.trim()).context("分享 URL 格式无效")?;
if parsed.scheme() != "https" || !parsed.host_str().is_some_and(|host| SHARE_HOSTS.contains(&host)) {
bail!("仅支持 Codex++ 分享站点链接");
}
if parsed.fragment().is_none() {
bail!("分享链接缺少解密密钥");
}
Ok(parsed)
}
fn decrypt_shared_payload(encrypted: &Value, key_value: &str) -> anyhow::Result<Vec<u8>> {
if encrypted.get("v").and_then(Value::as_u64) != Some(1) {
bail!("不支持此分享的数据格式");
}
let decode = |field: &str| -> anyhow::Result<Vec<u8>> {
let value = encrypted
.get(field)
.and_then(Value::as_str)
.with_context(|| format!("分享数据缺少 {field}"))?;
base64::engine::general_purpose::URL_SAFE_NO_PAD
.decode(value)View on GitHub (pinned to b1ed92e5e4)