fix(media): 通过通用权限审批交付未知来源媒体 - #4044
Conversation
保留 Guide 名单作为免审批依据,未知来源及额外网络权限由 Host 发起单次普通权限审批。 媒体下载接入安全出口,复用本次授权自动重试并保留上游成功响应,避免重新付费生成。 补齐审批取消、Session 等待生命周期、五语言文案、回归用例和权限卡截图。 Signed-off-by: liugaowei <liugaowei@xd.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
| Filename | Overview |
|---|---|
| apps/desktop/src/main/cindy-media/invocationService.ts | 为过期地址刷新增加仅针对 POLL_UNAVAILABLE 的三次有界重试,并保持原成功响应直到新媒体成功入库。 |
| apps/desktop/src/main/cindy-media/mediaRequestLog.ts | 将 sig 和 OSSAccessKeyId 纳入统一敏感参数脱敏规则。 |
| apps/desktop/src/main/cindy-media/tests/invocationService.test.ts | 覆盖刷新网络错误、超时、5xx、重试耗尽、4xx 拒绝以及不重复付费提交等分支。 |
| apps/desktop/src/main/cindy-media/tests/mediaDownload.test.ts | 验证审批输入不会暴露新增覆盖的签名参数值。 |
| apps/desktop/src/main/cindy-media/tests/mediaRequestLog.test.ts | 验证新增敏感参数被遮蔽,同时普通查询参数保持可见。 |
Sequence Diagram
sequenceDiagram
participant C as Cindy
participant P as 媒体供应商
participant D as 下载器
participant S as 本地媒体仓库
C->>P: 查询已有任务
P-->>C: 成功响应(媒体 URL)
C->>D: 下载媒体
D-->>C: URL 已过期
loop 最多三次,仅网络错误/超时/5xx
C->>P: 刷新已有任务地址(poll)
P-->>C: 新响应或临时错误
end
C->>D: 下载刷新后的 URL
D->>S: 从临时文件分块入库
alt 下载及入库成功
S-->>C: cindy-media:// URL
C->>C: 原子更新为 complete
else 刷新、下载或入库失败
C->>C: 保留原成功响应及 pending 状态
end
Reviews (5): Last reviewed commit: "fix(media): 补齐地址刷新重试与签名参数脱敏" | Re-trigger Greptile
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ef921c9e2e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
将私网例外绑定到精确请求目标,防止同源跳转扩大访问范围。刷新结果入库成功前保留原响应,本地入库使用同一份已下载字节进行有界重试。 Signed-off-by: liugaowei <liugaowei@xd.com>
|
本轮修复已推送:
长期未交付记录的留存策略按既定需求保留,已在对应线程解释依据,并在 PR 风险部分明确披露空间增长,不新增自动淘汰或领取入口。 本地完整相关单测门禁、受影响包类型检查与两次提交的 DCO 检查通过。当前提交的自动 review 和 CI 仍在运行,尚不声明 review clean 或可合并。 |
|
@greptileai 请审查当前提交 4505e76。上一轮已核实的问题与修复、留存策略依据和验证结果见最近回复及 PR 正文。 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4505e76e19
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@GaoWeiLiuXD 👋 这个 PR 还有 2 条 review conversation 没 resolve(apps/desktop/src/main/cindy-media/mediaDownloadApproval.ts / apps/desktop/src/main/cindy-media/mediaDownload.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
|
本 PR 需要维护者确认后才能合并。 改动把 Guide 名单外的媒体 CDN 接到现有通用权限卡:批准后在客户端下载为 请维护者在本 PR 上 Approve 放行;需要修改就 Request Changes。讨论记录:#4047 |
Signed-off-by: liugaowei <liugaowei@xd.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cffcfe984f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@GaoWeiLiuXD 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/main/cindy-media/mediaDownload.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
|
@GaoWeiLiuXD 👋 这个 PR 改动了受保护的路径(.github/pr-assets/media-download-permission-light.png),auto-review 因此不合并、也不会自动审查。 这些路径的改动需要人工处理。如果执意要改,请联系 Lizi。 |
|
@greptileai 请审查当前提交 cffcfe9;上一轮结果仍绑定 4505e76。请只核实本次媒体下载改动的确定性问题。 |
Signed-off-by: liugaowei <liugaowei@xd.com>
|
@greptileai 请复核当前提交 2a2f3d8。本轮仅修正私网审批的具体目标展示,验证与范围见更新后的 PR 正文;磁盘容量保护已由需求方明确排除,并在原线程中记录为已知风险。 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a2f3d8456
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@GaoWeiLiuXD 👋 这个 PR 还有 3 条 review conversation 没 resolve(apps/desktop/src/main/cindy-media/mediaDownload.ts / apps/desktop/src/main/maker-host/outbound-fetch.ts / apps/desktop/src/main/cindy-media/invocationService.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
Signed-off-by: liugaowei <liugaowei@xd.com>
|
@greptileai 请复核当前提交 e275444:补齐 sig / OSSAccessKeyId 脱敏及原任务地址刷新的客户端有界重试,相关门禁已通过。风险与范围裁决见 PR 正文及各原线程,请勿将已明确排除的容量保护或新的永久网络阻断重新扩入本次修复。 |
这次改了什么
摘要
媒体生成成功后,如果供应商返回了 Guide 名单外的新 CDN,客户端原先会以
MEDIA_RESULT_INVALID拒绝交付。本 PR 保留名单作为免审批依据:正常已确认来源自动下载,名单外或需要额外权限时通过现有普通权限卡请求本次批准,允许后在 Cindy 内下载并保存为cindy-media://。网络故障由客户端自动重试并沿用本次授权,只有来源或权限超出已批准范围才重新确认。私网访问例外绑定精确 URL,路径或 query 变化须重新审批;卡片显示当前具体路径和脱敏后的参数,让用户能区分本次目标。拒绝直接停止;重试耗尽保留原生成响应并报告失败,不要求模型重新付费生成或反复请求批准。刷新地址遇到网络错误、超时或 HTTP 5xx 时最多尝试三次,明确的上游拒绝不重试;刷新结果成功入库前保留原响应;本地入库失败对同一份已下载文件最多尝试三次,不重新下载或审批。
URL 媒体从网络接收、MIME 探测到哈希入库全程采用有界内存:逐块写入 Host 私有临时文件,再通过原
ingestMedia和内容寻址仓入库。删除文件大小审批及额度状态,不将原内存实现的上限变成 URL 下载限制。base64 响应保持原规则;生成阶段沿用自身超时,下载上下文不再另设覆盖生成时间的九分钟计时器。变更类型
fix缺陷修复feat新功能refactor/perf重构或性能优化docs/test/chore文档、测试或工程维护范围
UI 变化
docs/design-rules/DESIGN.md§3 Typography Rules、§5 Layout Principles、§10 Light / Dark Dual-Mode Delivery Gate。复用现有PermissionPrompt的排版、聊天底部位置和主题语义 token;只增加来源展示与下载审批文案,没有新增窗口、遮罩或硬编码颜色。怎么验证的
自动验证
当前 head
e2754445c:Greptile 5/5、Codex Code/Security Review 均完成,未解决线程为 0;Linux/Windows 全部 CI、Git integration、DCO 与汇总校验通过。Linux 第二组首次因未改动的 PI foreground 取消 fixture 进程退出而失败,未修改代码,重跑失败作业后通过。维护者人工批准仍待完成。当前修正提交
e2754445c:Desktop 类型检查通过;根test:unit:related的公共包与测试调度器通过。Desktop 首次遇到测试进程 SIGSEGV(无用例断言失败),随后通过相同根门禁的--workspace desktop --workspace-concurrency=1完整重跑通过(126.5s),未修改测试调度或依赖。5 个提交 DCO 检查通过。本批补充
sig/OSSAccessKeyId脱敏回归,以及过期地址刷新遇到网络错误、超时、HTTP 5xx 后重试成功、耗尽保留原响应、HTTP 401 不重试;所有分支均验证只有一次付费提交。新增回归验证同源私网路径/普通 query 变化时审批内容可区分,以及登录信息、签名值和 fragment 不进入卡片;仍使用普通 permission 链路。
Desktop 类型检查通过;另外两个受影响公共包无
typecheckscript,按仓库契约跳过。pnpm check:i18n、pnpm check:i18n-glossary:通过,五语言 9098 keys 一致,无新增术语违规。回归覆盖来源/权限审批、逐跳网络隔离、下载和本地入库重试、原响应保留;新增有/无 Content-Length 的分块下载、超原上限 URL 结果、临时文件失败/取消清理、文件源内容寻址去重与记账,以及生成超过九分钟仍保持下载上下文有效。
验证复用 worktree 现有依赖;测试显式使用 Global 区域,不修改共享
.env。未新增或升级依赖。手工验证
feature/safe-media-download,独立cindy-local开发实例。permission_request,确认卡片在聊天底部显示来源、原因与本次范围,使用现有允许/拒绝交互;没有创建真实待审批请求,也没有发起媒体下载。未执行的验证
@cindy/maker-core build类型检查有 54 个基线诊断;用 TypeScript compiler host 将本次两个文件替换为 HEAD 源码只读对照,当前与基线诊断相同,无新增。该包没有typecheckscript,不将此额外检查描述为通过。风险
风险分类
影响与回滚
提交前检查
git commit -s,见 DCO)