{"record":{"id":"2146b2a66f99c862","repo":"BigPizzaV3/CodexPlusPlus","slug":"codex-2146b2","errorCode":null,"errorMessage":"仅支持 Codex++ 分享站点链接","messagePattern":"仅支持 Codex\\+\\+ 分享站点链接","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/session_share.rs","lineNumber":110,"sourceCode":"        .fragment()\n        .and_then(|fragment| {\n            fragment\n                .split('&')\n                .find_map(|pair| pair.strip_prefix(\"k=\"))\n        })\n        .context(\"分享链接缺少解密密钥\")?;\n    let plaintext = decrypt_shared_payload(encrypted, key_value)?;\n    let payload: Value = serde_json::from_slice(&plaintext).context(\"分享会话内容格式无效\")?;\n    if payload.get(\"kind\").and_then(Value::as_str) != Some(\"codex-rollout\") {\n        bail!(\"当前分享内容不是可导入的 Codex rollout 会话\");\n    }\n    import_rollout(home, &payload)\n}\n\nfn validate_share_url(url: &str) -> anyhow::Result<reqwest::Url> {\n    let parsed = reqwest::Url::parse(url.trim()).context(\"分享 URL 格式无效\")?;\n    if parsed.scheme() != \"https\" || !parsed.host_str().is_some_and(|host| SHARE_HOSTS.contains(&host)) {\n        bail!(\"仅支持 Codex++ 分享站点链接\");\n    }\n    if parsed.fragment().is_none() {\n        bail!(\"分享链接缺少解密密钥\");\n    }\n    Ok(parsed)\n}\n\nfn decrypt_shared_payload(encrypted: &Value, key_value: &str) -> anyhow::Result<Vec<u8>> {\n    if encrypted.get(\"v\").and_then(Value::as_u64) != Some(1) {\n        bail!(\"不支持此分享的数据格式\");\n    }\n    let decode = |field: &str| -> anyhow::Result<Vec<u8>> {\n        let value = encrypted\n            .get(field)\n            .and_then(Value::as_str)\n            .with_context(|| format!(\"分享数据缺少 {field}\"))?;\n        base64::engine::general_purpose::URL_SAFE_NO_PAD\n            .decode(value)","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/session_share.rs#L92-L128","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nimport_shared_session_url(home, \"https://my-share.example.com/s/abc#k=...\")?;\n// after\nimport_shared_session_url(home, \"https://share.codexpp.cc/s/abc#k=...\")?;","handlingStrategy":"validation","validationCode":"fn is_official_share_url(url: &str) -> bool {\n    const SHARE_HOSTS: &[&str] = &[\"share.codexpp.cc\", \"codexpp-share.pages.dev\"];\n    reqwest::Url::parse(url.trim()).map(|u| u.scheme() == \"https\" && u.host_str().is_some_and(|h| SHARE_HOSTS.contains(&h))).unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only distribute links from official share hosts","Warn users when pasting non-official domains","Keep the SHARE_HOSTS allowlist in sync with actual deployments"],"tags":["url","security","allowlist"],"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"}