{"record":{"id":"43baa2182c21b1a7","repo":"BigPizzaV3/CodexPlusPlus","slug":"label","errorCode":null,"errorMessage":"{label}超过大小限制","messagePattern":"(.+?)超过大小限制","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/connect/weixin.rs","lineNumber":370,"sourceCode":"        .render::<qrcode::render::svg::Color>()\n        .min_dimensions(320, 320)\n        .dark_color(qrcode::render::svg::Color(\"#111827\"))\n        .light_color(qrcode::render::svg::Color(\"#ffffff\"))\n        .build())\n}\n\nasync fn read_response_limited(\n    response: reqwest::Response,\n    max_bytes: usize,\n    label: &str,\n) -> anyhow::Result<(reqwest::StatusCode, Vec<u8>)> {\n    let status = response.status();\n    let mut stream = response.bytes_stream();\n    let mut bytes = Vec::new();\n    while let Some(chunk) = stream.next().await {\n        let chunk = chunk.with_context(|| format!(\"读取{label}失败\"))?;\n        if bytes.len().saturating_add(chunk.len()) > max_bytes {\n            bail!(\"{label}超过大小限制\");\n        }\n        bytes.extend_from_slice(&chunk);\n    }\n    Ok((status, bytes))\n}\n\nimpl WeixinMessage {\n    pub fn is_finished_user_message(&self) -> bool {\n        self.message_type == 1 && self.message_state == 2 && !self.from_user_id.trim().is_empty()\n    }\n\n    pub fn text(&self) -> Option<String> {\n        self.item_list.iter().find_map(message_item_text)\n    }\n\n    pub fn dedup_key(&self) -> String {\n        format!(\n            \"{}|{}|{}|{}|{}\",","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/connect/weixin.rs#L352-L388","documentation":"read_response_limited streams the HTTP response body and enforces a byte cap (max_bytes); if accumulated bytes would exceed the cap it bails with '{label}超过大小限制'. This protects against unbounded/downsized-response attacks or unexpectedly huge payloads from the WeChat endpoints.","triggerScenarios":"Any caller (fetch_qr_code, poll_qr_status, get_updates, send_text) receiving a response whose streamed body exceeds the per-call MAX_*_BYTES limit while chunks are accumulated in read_response_limited.","commonSituations":"A compromised or misbehaving proxy returning a huge body, a misconfigured endpoint that is not actually the WeChat API (e.g. a large HTML error page served as 200), or QR/status payloads inflated by an intermediary.","solutions":["Verify the endpoint URL is the genuine WeChat API; a non-WeChat server may return oversized bodies.","Check intermediaries (proxies, captive portals) that inject large HTML into responses.","If a legitimate larger payload is required, raise the corresponding MAX_*_BYTES constant in weixin.rs and rebuild.","Inspect what the server actually returns with curl to confirm body size and content type."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// before calling, verify the endpoint is the real API\nlet resp = client.get(api_base).send().await?;\nlet ct = resp.headers().get(\"content-type\").and_then(|v| v.to_str().ok());\nanyhow::ensure!(ct.map_or(false, |c| c.contains(\"json\")), \"endpoint not returning JSON\");","typeGuard":null,"tryCatchPattern":"// Rust\nmatch connector.fetch_qr_code().await {\n    Err(e) if e.to_string().contains(\"超过大小限制\") => {\n        // treat as endpoint misconfig/interference: log URL, switch or disable connector\n        Err(anyhow!(\"WeChat endpoint returned oversized body; check proxy/URL\"))\n    }\n    other => other,\n}","preventionTips":["Pin the exact WeChat API base URL in config; avoid proxies that rewrite bodies","Monitor response content-types from the endpoint in CI/health checks","Only raise MAX_*_BYTES constants deliberately, with review"],"tags":["network","security","size-limit","weixin"],"backgroundTag":"file-size-limit-exceeded","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"}