Skip to content

fix(update): 解压 tar 后校验 gzip footer - #442

Open
MistEO wants to merge 2 commits into
mainfrom
codex/update-gzip-integrity
Open

MistEO wants to merge 2 commits into
mainfrom
codex/update-gzip-integrity

Conversation

@MistEO

@MistEO MistEO commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

tar 解压会在结束块处停止,带有末尾填充的 tar.gz 可能尚未读到 gzip footer,导致 CRC/ISIZE 损坏或 footer 截断的包也返回解压成功。

现在解压后继续读取 gzip 解码器到 EOF,完成 footer 校验;损坏仍走现有 corrupt 错误分类,目标目录等 IO 错误保持原分类。沿用单 gzip member 行为。

校验错误通过结构化错误标识交给前端按当前语言显示,覆盖简体中文、繁体中文、英语、日语和韩语;原始诊断仍供日志使用。保留旧错误载荷与普通错误详情的兼容行为。

独立 review 通过。新增 4 项回归覆盖正常填充包、CRC/ISIZE 损坏、缺失 footer 和目标目录 IO 错误,均执行实际 extract_zip 入口。

验证:Windows 完整 crate 的 Cargo lib-test 编译通过。原测试 exe 因现有 Common Controls v6 manifest 缺失而在加载阶段退出;给该编译产物的副本嵌入 Tauri 默认 manifest 后,4 项测试全部通过。rustfmt 和 git diff --check 通过。没有修改系统 DLL 或提交构建环境调整。

前端新增回归执行实际安装流程和显示函数,验证五种语言、损坏包清理、IO 错误重试及旧载荷兼容。pnpm test 122 项通过、1 项既有 macOS 专属测试跳过;pnpm build 和变更文件 Prettier 通过。

基于 main c321532。本次校验失败时 staging 可能已产生文件,现有安装流程会在收到错误后终止应用。

Sourcery 摘要

在 tar 解压后验证 gzip 尾部信息,避免接受损坏的更新包,同时保留现有的错误分类。

Bug Fixes:

  • 确保读取完 tar 内容后验证 tar.gz 解压过程中的 gzip 文件尾部信息,拒绝 CRC/ISIZE 元数据损坏或截断的软件包。

Tests:

  • 添加端到端解压回归测试,覆盖带填充的有效归档、损坏的 gzip 文件尾部、缺失的文件尾部以及目标位置 I/O 故障。
Original summary in English

Sourcery 摘要

拒绝 gzip 尾部无效的更新归档,并通过本地化的安装错误反馈失败,同时不改变现有错误处理语义。

Bug 修复:

  • 在解压 tar 后验证 gzip 尾部,确保不会将 CRC/ISIZE 元数据无效的填充或截断更新归档误判为成功。
  • 在向安装界面展示本地化的 gzip 验证错误时,保留现有的损坏和 I/O 错误分类。

改进:

  • 为 gzip 验证失败添加本地化安装提示,同时保留原始诊断信息以供日志记录,并兼容旧版错误载荷。

测试:

  • 添加端到端回归测试,覆盖有效的填充归档、损坏或缺失的 gzip 尾部、目标位置 I/O 失败、本地化错误处理、清理行为以及旧版载荷兼容性。
Original summary in English

Summary by Sourcery

Reject update archives with invalid gzip footers and surface the failure through localized installation errors without changing existing error handling semantics.

Bug Fixes:

  • Validate gzip footers after tar extraction so padded or truncated update archives with invalid CRC/ISIZE metadata are rejected instead of being accepted as successful.
  • Preserve existing corruption and I/O error classification while exposing a localized gzip-validation error to the installation UI.

Enhancements:

  • Add localized installation messaging for gzip validation failures while retaining raw diagnostics for logging and compatibility with legacy error payloads.

Tests:

  • Add end-to-end regression coverage for valid padded archives, corrupted or missing gzip footers, destination I/O failures, localized error handling, cleanup behavior, and legacy payload compatibility.

AI 使用信息:

  • 实现、内部审查:Agent 为 Codex;模型为 gpt-6-astra;思考强度为 ultra。内部子代理继承父任务配置。
  • 审计交叉审查:Agent 为 Codex;模型为 gpt-6.1-sol;思考强度为 max(协调调用选定)。

@MistEO
MistEO marked this pull request as ready for review November 11, 2026 02:47
Copilot AI balanced review requested due to automatic review settings November 11, 2026 02:47
@sourcery-ai

sourcery-ai Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Sorry @MistEO, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 7 hours and 29 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T03:06:17.542901Z 33e72a0 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9be75bf555

ℹ️ 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".

Comment thread src-tauri/src/commands/update.rs Resolved
@MistEO
MistEO marked this pull request as draft November 11, 2026 02:50
@MistEO
MistEO marked this pull request as ready for review November 11, 2026 03:04
@sourcery-ai

sourcery-ai Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Sorry @MistEO, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 7 hours and 21 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants