Skip to content

fix(wework): protect document links and native credentials - #4479

Merged
qdaxb merged 94 commits into
wecode-ai:mainfrom
Micro66:fix/wework-document-credential-security
Nov 17, 2026
Merged

qdaxb merged 94 commits into
wecode-ai:mainfrom
Micro66:fix/wework-document-credential-security

Conversation

@Micro66

@Micro66 Micro66 commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

DOCX 危险链接可能在第三方预览中执行,通用密钥接口及前端模型探测扩大了凭据暴露面。本变更在渲染前净化 DOCX 关系链接,移除 HTTP/SDK 通用密钥接口,将保存凭据、模型发现及已保存模型探测收敛到 Electron 原生服务。

首次原子复制旧模型配置、模型密钥及云设备凭据到 protected-credentials,秘密使用系统保护的 v3 存储;之后只读写新版存储,清空或退出保留空标记。旧文件保留供原版回滚,新旧版本后续写入独立,历史旧文件暴露风险仍存在。手动选择旧目录文件、目录别名及旧绑定时也先复制到新版保护目录;普通外部配置仍可编辑。保存连接改址须重新输入密钥,原生接口不返回密钥或远端错误正文。

Core 插件支持 npm、Git 和绝对本地来源。安装、更新及开发启动前,原生窗口显示字面来源与执行风险,默认取消;HTTP 入口遵循同一授权,取消先于事务、停止现有开发会话及创建进程。已删除自动放行受阻安装脚本的重试。DOCX 危险外部关系保持惰性,HTTPS 对照保留;读取或安全处理失败时可显式重试。

flowchart LR
  Legacy[旧凭据] -->|首次原子复制| Protected[系统保护的新存储]
  Native[原生凭据与模型服务] <--> Protected
  Old[回滚旧版] <--> Legacy
  Plugin[安装 / 更新 / 开发启动] --> Consent[原生来源与风险确认]
  Consent -->|允许| Execute[事务或开发进程]
  Consent -->|取消| Stop[保留原状态]
  Docx[DOCX] --> Sanitize[净化关系链接] --> Preview[第三方预览]
Loading

当前 HEAD:46056966d2d00ed531613beb788e52f879782166;已集成 main 28bc61061eecaf8ae7f3eab2aca019872a6cfe17。功能完成后已整体审查,最终树为 aea547c275f9c89c60a0a5fefdf13184c8eba7de,工作区干净。正常提交钩子通过;按用户要求未手动运行本机测试、类型、lint、编译或 E2E 套件,以下执行结果均来自当前 HEAD 的 GitHub CI。

模型目录复用现有缓存抽象,本机和云端独立发布;普通对话保留仍有效的模型和选项,提交本机设置会使旧读取失效,迟到响应不能覆盖新状态。保留原有身份合并、凭据和执行权限边界。测试夹具复用现有隔离运行时与 UI 模型选择器,明确场景协议前提;插件策略准备采用上游设备 ACK 与现有写锁,不依赖偶然调度顺序。原始断言、期限、授权和取消覆盖保留。

保留上游停止后迁移、会话/Goal/历史连续性、归档所有权及同步消息接纳规则,源内容通过已授权工具读取。Dockerfile 相对已集成 main 完全不变,复用现有测试镜像和共享产物,没有组织镜像写入。

当前 HEAD 的验证结果:

  • Tests、Lint、平台 E2E、Wework E2E 的最终摘要全部成功,Repository/Binary Policy 两项必需检查也成功。原生查询的 6 项必需检查全部 SUCCESS;90 个当前 check run 中 80 成功、10 条件跳过、0 待定或失败,跳过项不算执行通过。当前 Cloud3、Core3/4/10 原始场景、策略准备 4 项回归、模型刷新 5 项回归及 Linux 私有 X11/keyring 生命周期 5 项均已核对当前源执行证据。
  • 完整签名与真实包运行 44096614593 最终成功,绑定本 HEAD;实际 Prepare 版本为 0.6.10-beta.5,channel=beta、publish_release=false、build_only=false、verification_checkpoint=all。未指定版本覆盖,未发布版本或推广目录。
  • 冻结来源为最低来源 0.6.10-beta.2(06f2cbee8b4371072fbd8477fcd2d6985431f710)和当时最新已发布 0.6.10-beta.4(66e8ab3455cbccebbf7f6c72dadfda87d234ae37),目标为 Beta.5。suite25 的 4 组独立真实包升级/回滚/再升级均通过:macOS arm64 的 Beta.2、Beta.4,Windows x64 的 Beta.2、Beta.4。已回读全部原始报告并核对双端包哈希、sourceSha、suite25、运行号及成功 CI。
  • 正式包安全报告 确认真实 Backend 登录、重启刷新及后续认证请求、DOCX 危险链接与 HTTPS 对照、原生插件安装/更新/开发的取消与允许、渲染进程凭据拒绝及重启后原生模型认证;报告已绑定当前 ARM 目标包哈希。四个包对均证明独立凭据复制、旧文件与绑定保留、回滚后的原生认证写入、再升级旧文件哈希不变、回滚隔离及显式确认、组件归属、原线程 6 轮与真实工具历史、Goal 自动续跑、分叉/压缩连续性。macOS 两个来源另有中断回滚、暂停 Goal 重启及失败激活恢复原始报告。
  • 全部 3 份 Beta 候选策略 已核对,原历史包、边及撤销记录不变。macOS x64 的 自身包元数据 与 ARM 的双端源修订一致,2 条路径明确声明 architecture-equivalence 并保留 x64 自身哈希;不把它算作独立执行。没有为中间版本伪造单独边,也没有生成新的 Stable 边。

实际目标升级包 SHA256:

平台 SHA256
macOS arm64 d96bed313c0b7fc58cf11dcd16572f8cdf068028d9190e6002150ad53c4c95a0
Windows x64 a6059500878262a4fae57553afa82a634cce8d0ed890ac6bd7f06fc696db2201
macOS x64 844cd62324225ca9a299b9a35844a6d9ddf6c24762f1a9f66c286c9d143a2d54

保留事项:升级验证执行约 14 分 18 秒,超出现有 10 分钟性能目标,原有警告保留;未延长硬期限或放宽断言,CI 最终成功。历史 Core1 排队失败的旧日志未能证实根因,当前 HEAD 原场景已通过,不据此宣称旧根因已解决。四条旧来源失败与 evidence=null 保留,不生成新升级边;旧文件历史凭据暴露风险仍在既定验收边界内。

安全交接 Issue:WEWORK2D8526-144;跟进任务:WEWORK2D8526-168。当前 HEAD 的必需 CI 与完整真实包证据均已通过,交 qindi 复审;收到明确人工同意并满足仓库保护后再合并。

Summary by CodeRabbit

  • New Features
    • Added safer DOCX previews, with a retry option when reading or security checks fail.
    • Added model connection testing with clearer, localized failure messages.
  • Security
    • Added native confirmation for plugin installation, updates, and development sessions.
    • Restricted unsafe external links and removed plugins’ direct access to credential storage.
    • Improved credential protection and migration across upgrades and rollbacks.
  • Reliability
    • Added checks to help prevent incompatible upgrades and preserve rollback safety.
    • Improved startup coordination and macOS status-item verification.

@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review
Walkthrough

The changes add protected credential storage and migration, host-side model connection testing, native approval for plugin operations, DOCX sanitization and retry, external-link filtering, and release-startup locking. Desktop upgrade tests now verify credentials and rollback evidence. Release workflows add security checks and macOS architecture-equivalence verification.

Changes: Protected credentials and upgrade verification

Layer / File(s) Summary
Protected credential storage
wework/electron/src/host/*, wework/electron/src/shared/*, wework/electron/electron-builder.config.cjs, wework/AGENTS.md, docs/en/wework/developer-guide/wework-upgrades.md, docs/zh/wework/developer-guide/wework-upgrades.md
Cloud and model credentials use a version-3 protected store and native secret protection. Legacy data import, tombstones, storage metadata, and recovery cleanup are added or updated.
Model configuration and connection tests
wework/electron/src/host/model-configuration-*, wework/electron/src/shared/model-*, wework/src/features/model-settings/*, wework/src/components/settings/*
Model configuration protects inline credentials and reports credential status without exposing raw keys. Connection tests run through host capabilities and shared provider and probe definitions.
Upgrade and rollback evidence
wework/e2e/desktop/modules/upgrade-*, wework/e2e/desktop/modules/rollback-protection.mjs, wework/e2e/desktop/scenarios/app-upgrade.scenario.mjs, wework/e2e/desktop/upgrade-suite.mjs, wework/scripts/*upgrade*, wework/scripts/rollback-protection.test.mjs, wework/upgrade-policy.json
Upgrade checks record credential stages, rollback protection, re-upgrade results, and package identity. Evidence validation requires credential round-trip checks.

Plugin admission and extension boundaries

Layer / File(s) Summary
Native approval for plugin operations
wework/electron/src/host/core-dsh-plugin-approval.ts, wework/electron/src/runtime/*plugin*, wework/electron/src/main.ts, wework/src/components/plugins/*, wework/src/i18n/locales/*/common.json, wework/e2e/desktop/modules/native-plugin-approval.mjs, wework/e2e/desktop/modules/*plugin*, wework/e2e/desktop/scenarios/*plugin*, docs/en/wework/*plugins*.md, docs/zh/wework/*plugins*.md
Plugin install, update, and development flows request native confirmation before package or session changes. The UI and documentation describe the confirmation behavior.
Extension secret-storage boundary
wework/dsh/app-wework/client.*, wework/dsh/electron-host/*, wework/dsh/plugin-developer/codex-plugin/skills/develop-wework-plugin/*
The extension runtime and HTTP host no longer expose secure-storage methods. Plugin guidance places credential handling in the Node backend.

Document preview and links

Layer / File(s) Summary
DOCX sanitization and retry
wework/src/lib/safe-office-preview.*, wework/src/components/layout/workspace-panels/WorkspaceFilePreview.*, wework/e2e/desktop/modules/office-preview-fixtures.mjs, docs/en/wework/developer-guide/wework-file-preview.md, docs/zh/wework/developer-guide/wework-file-preview.md, docs/en/wework/interface-navigation.md, docs/zh/wework/interface-navigation.md
DOCX relationship targets are checked before rendering. Preparation failures show a retry path, and tests cover sanitization and retry behavior.
External-link handling
wework/src/lib/external-links.*
Click and auxiliary-click handlers block unsafe schemes and handle fragment and empty targets.

Release startup ownership

Layer / File(s) Summary
Native startup lock
wework/launcher/src/*, wework/electron/src/runtime/release-startup-owner.*
The launcher adds a lock-serving command. Electron resolves a lock identity, acquires ownership through the launcher, and handles lock loss and release errors.
Startup routing and tests
wework/electron/src/release-bootstrap.ts, wework/electron/src/bootstrap.test.ts, wework/electron/src/runtime/release-startup-owner.test.ts, wework/e2e/desktop/modules/release-startup-owner.test.mjs
Release routing now runs under startup ownership. Tests cover acquisition ordering, loss, release failures, and ownership across process aliases.

Desktop verification and release workflows

Layer / File(s) Summary
Desktop test environment and process inspection
docker/wework-e2e/desktop.Dockerfile, wework/e2e/desktop/run-with-*, wework/e2e/desktop/modules/*, wework/e2e/desktop/xvfb-lifecycle.test.mjs, wework/src/e2e/desktop-cloud-*.test.ts
The desktop test setup adds keyring, D-Bus, and Xvfb support. E2E helpers inspect the connected process, wait for authorization polling, and check native macOS tray state.
Release build and aggregation
.github/workflows/wework-app.yml, .github/scripts/wework-release-workflow.test.mjs, .github/workflows/test.yml, wework/scripts/upgrade-evidence.test.mjs, wework/upgrade-policy.json
Build verification adds security and native-contract checks and retains evidence. Aggregation verifies macOS x64 package identity and architecture equivalence before policy upload; publication no longer mirrors arm64 upgrade paths into macOS x64 assets.

Estimated code review effort: 5 (Critical) | ~120 minutes

Change: Bug fix

Suggested reviewers: qdaxb

Merge Risk: Moderate · up to 6ee13

The upgrade verification gate can still accept evidence for pure v2 upgrades that never proved an authenticated credential write after the upgrade, and the model-key upgrade check can miss a lost legacy key. Tighten both before using this evidence to publish upgrade edges.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(wework): protect document links and native credentials" matches the main changes in the changeset. The diff sanitizes DOCX relationship links before preview (safe-office-preview.ts, ext…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title "fix(wework): protect document links and native credentials" matches the main changes in the changeset. The diff sanitizes DOCX relationship links before preview (safe-office-preview.ts, external-links.ts). It moves saved credentials into a protected v3 store backed by native Electron safeStorage and removes the secureStorage and secrets interfaces. It also adds native confirmation before plugin install, update, and development start. The title names the three main themes concisely and uses the conventional commit format. It does not mention the Xvfb, upgrade verification, or E2E harness work, which is expected for a title of this length.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Wegent Test added 26 commits November 12, 2026 21:53
…ites

Integrate main upgrade policy changes with the suite25 credential acceptance contract.
Resolve private model references inside the native host before existing local or configured cloud runtime dispatch.
Fix native authorization, modal targeting, foreground input and reference-navigation defects established by current desktop CI logs.
Preserve the upstream personal-work navigation and DOCX preview retry entry.
Keep native security fixes, suite25 acceptance, and the existing desktop image unchanged.
Integrate main baa2b17 after the confirmed navigation conflict, preserving new knowledge-event coverage and the DOCX Retry entry. Resolve GTK EWMH modal discovery and require native idleness before cloud fault injection. Isolate ordinary macOS test credential identities and retain release identities. Capture the unresolved browser transport cause without request URLs.
Integrate main 8d19c8d while preserving native credential isolation, DOCX sanitization, explicit plugin approval and suite25 upgrade evidence. Resolve saved MiniMax discovery inside the native host and reuse the shared model probe with redirects denied. Validate the latest published Beta source against the next nonpublishing candidate.
Keep the original assertion Promise bound to its Inspector object group until
its real result is returned, with immediate rejection observation and the
existing shared evaluation deadline. Release bindings on every exit without
masking the original failure.

Add real V8 garbage-collection, rejection, ownership and disconnect regression
coverage to the existing native contract suite. Select the latest published
Beta.2 as the source floor for the next nonpublishing Beta candidate.
Classify verified history pagination, saved invocation and Goal eligibility
reads so their original responses finish before changing authentication.
Preserve native continuation ownership, mutation and unknown-request guards,
and the existing admission deadline.

Record queued-turn admission ownership and cleanup boundaries to diagnose the
unresolved async-answer queue failure without changing scheduling semantics.
Cover cleanup order and queueIfBusy combinations through the existing handler
unit suite. Keep Dockerfiles and original E2E assertions unchanged.
@qdaxb
qdaxb merged commit 2a7319f into wecode-ai:main Nov 17, 2026
91 checks passed
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