Repository navigation
fix: preserve browser environment and validate short repository roots - #45
Merged
Sandyzzx merged 1 commit intoOct 16, 2026
Conversation
Sandyzzx
approved these changes
Oct 16, 2026
Sandyzzx
left a comment
Owner
There was a problem hiding this comment.
维护者审查结论:APPROVE WITH NOTES
三项修复均经独立核实为真实缺陷,修复最小且位置正确;独立验证全部通过,仅余两条不阻断的 P3 建议。
缺陷核实(对照 master 1.2.5 源码逐项确认)
- F1:
spawn-worker.ts以createWorkerEnv(process.env)构建 detached worker 环境,白名单缺两个浏览器键,而 adapter 在 worker 内从自身环境读取——env-only 配置确实在真实 spawn 边界丢失。修复为白名单显式加两个非秘密键,任意ZCODE_BRIDGE_*仍被过滤(有测试断言)。 - F2:
createMinimalOsEnv按toUpperCase匹配且保留原始键大小写,旧executable.ts却用精确属性访问,ProgramFiles混合大小写读不到。windowsEnvValue大小写不敏感扫描是正确修法。 - F3:裸子串正则同时存在误报(POSIX 短根对
/vocab/applicator等 URL 片段)与漏检(Windows 原生单分隔符路径)。新边界正则我用 13 个独立探针验证:Windows 转义/原生/file URI 泄漏仍被拦截,URL 深层段、同级目录(/app Backup、/app@2、/app.git)、不同盘符均不误报。
独立验证
| 检查 | 结果 |
|---|---|
| CI | 双平台 success |
| 生成物同步 | 干净 npm ci + 重建后三个 bundle 与提交 blob 逐字节一致 |
| typecheck / build / validate:plugin | Node 24 与 Node 22.18.0 均通过;版本 1.2.5 未提升 |
| 全量测试 Node 24 | 364 项:363 通过 / 1 跳过 / 0 失败——与 PR 声明一致 |
| 全量测试 Node 22.18.0 | 362 通过 / 1 项 teardown ENOTEMPTY 抖动(runtime-remediation.test.js,本 PR 未触及该文件;隔离复跑 7/7 通过)/ 1 跳过 |
| 契约 | MCP schema 零改动;环境转发纯增量;显式路径优先级不变 |
非阻断建议(P3)
buildRepoRootLeakPattern对病态检出根(/、C:\)无守卫——根为/时会匹配所有//行注释开头。现实中几乎不会这样检出,建议后续加根长度/盘符根守卫。- 本次全量跑出的 1 项 teardown 抖动(
ENOTEMPTYrmdir)与此前state.lock的 EPERM/ENOTEMPTY 同属一族 Windows 文件系统时序问题,非本 PR 引入;建议在 master 上单独立项根治(锁获取的瞬时错误重试白名单 + 测试 teardown 容错)。
未验证项:真实 Linux /app 容器端到端(PR 已含断网 rootless 容器验收记录);macOS/ARM。跨 ZCode 版本浏览器协议兼容维持 Observed 状态。
感谢这份高质量贡献——真实跨进程 spawn 边界探针弥补了 #43 缺失的测试类,返修过程记录完整可信。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
在已合并 #43 的 1.2.5 基础上修复三项独立跨环境验收发现的问题。用户仅通过环境变量开启浏览器时,真实 detached worker 之前会丢失配置;Windows 的系统安装目录变量也被过滤,导致已安装 Edge/Chrome 仍无法自动发现;仓库检出到容器常见的
/app路径时,插件校验会把 JSON Schema URL 中的/vocab/applicator误判为本地开发路径泄漏。修复
ZCODE_BRIDGE_BROWSER_USE/ZCODE_BRIDGE_BROWSER_EXECUTABLE,任意父进程环境与秘密继续过滤。版本仍为 1.2.5;未改变 MCP schema、依赖锁、CI Node 版本、账户设置或权限合同。
独立验收(最终提交代码)
/app浏览器演示包括独立包 MCP 初始化与 1.2.5 版本检查、缺浏览器诊断、真实导航/填写/单次点击、页面确认、服务器恰好一次接收、截图与退出。浏览器后端实测不依赖仓库的 node_modules。
另有 19 项独立路径边界探针通过;Windows CLI 的转义绝对路径/注释注入、Linux
/app下的绝对路径/注释/file URI 注入均被拒绝。三个 bundle 的 Windows 交付与 Linux 干净重建 SHA256 一致(统一 LF 后比较);git diff --check通过。详细范围、指纹与复现测试见 修复与独立验收报告。范围与清理
Linux 验收容器为 UID 1000、断网、无宿主挂载、cap-drop=all、no-new-privileges。Windows 为独立目录和最小进程环境,未声称 Windows OS 沙箱。所有任务容器和派生镜像已移除;Windows 临时文件已回收,浏览器进程和测试端口均确认退出,原始证据保留。
未运行 macOS/ARM 实机、真实模型服务端到端或跨 ZCode 版本认证。既有 Windows 锁并发抖动本次未复现,未将其宣称为已修复;本机已安装插件未升级。远端 CI 结果以本 PR 检查为准。