feat(weixin): support incoming image and file attachments#1765
feat(weixin): support incoming image and file attachments#1765piorpua merged 5 commits intoiOfficeAI:mainfrom
Conversation
773bb36 to
2b6738a
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
5b1fa50 to
ef7c5b6
Compare
- WeixinMonitor: detect image (type=2) and file (type=4) items, download from WeChat CDN with optional AES-128-ECB decryption, sniff file type from magic bytes. Passes attachments as a typed field on WeixinChatRequest (not embedded in text). - WeixinAdapter: assembles the agent message — appends [Image: /path] or [File "name": /path] markers to the text so the agent can read the files. - WeixinPlugin: resolves the uploads directory lazily with caching. Looks up the existing weixin conversation workspace via DB on first attachment and caches the path; falls back to dataDir/weixin-uploads/ if no conversation exists yet (first ever message). - TTL + size-cap cleanup runs after each batch of downloads. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Store all WeChat attachments in dataDir/weixin-uploads/ with 72-hour TTL. Removes the workspace-resolution logic that was unreliable across agent switches. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
When a message contains only media items (no text) but all CDN downloads fail, agent.chat was still called with empty text and no attachments. Also reformats the code to pass the Oxfmt format check. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
ef7c5b6 to
af934eb
Compare
Code Review:feat(weixin): support incoming image and file attachments (#1765)变更概述本 PR 为微信频道新增了图片和文件附件的接收支持:在 方案评估结论: 整体方案思路合理:将附件路径以 marker 形式注入 text 字段,不改变 IPC/Agent 接口,改动影响面很小。下载 + 解密 + 存储的实现也与现有架构(main process 直接 fs 操作)一致。但 问题清单🟠 HIGH —
|
| # | 严重级别 | 文件 | 问题 |
|---|---|---|---|
| 1 | 🟠 HIGH | WeixinMonitor.ts:267 |
msgId 未过滤拼入文件路径,存在路径穿越风险 |
| 2 | 🔵 LOW | weixinMonitor.test.ts:101 |
测试名称与新行为不符 |
结论
本报告由本地 pr-review skill 生成,包含完整项目上下文,无截断限制。
CONCLUSION: CONDITIONAL
IS_CRITICAL_PATH: false
PR_NUMBER: 1765
Prevent path traversal by stripping non-alphanumeric characters from msgId (sourced from WeChat API) before constructing the upload filename, matching the existing safeName treatment for declaredName. Review follow-up for iOfficeAI#1765
PR Fix 验证报告原始 PR: #1765
总结: ✅ 已修复 1 个 | ❌ 未能修复 0 个
|
Summary
dataDir/weixin-uploads/with 72-hour TTL and 200 MB cap[Image: /path]or[File "name": /path]markers in the message textTest plan
[Image: ...]and can describe it[File "name": ...]and can read itweixin-uploads/and are cleaned up after 72 hours🤖 Generated with Claude Code