feat(v0.1.1): deep runtime hardening + CodeWhale catalog v2 + models.dev sync#10
Open
purrfecto114-lgtm wants to merge 2 commits into
Open
feat(v0.1.1): deep runtime hardening + CodeWhale catalog v2 + models.dev sync#10purrfecto114-lgtm wants to merge 2 commits into
purrfecto114-lgtm wants to merge 2 commits into
Conversation
…dev sync ## 概要 在 v0.1.0 基础上完成 46 文件、+8378 / −7266 行的深度加固。核心改进分为五大方向: ### 1. 渲染进程安全加固 - Electron 43.1.1:sandbox / contextIsolation / webSecurity 全开 - nodeIntegration / webviewTag 关闭 - 严格 CSP:禁止外部脚本与网络连接 - 拦截导航、新窗口、下载、设备/媒体权限 - 每个 IPC 校验 sender 与本地页面 ### 2. 本地 HTTP 安全升级 - 回环地址 + 每次启动随机令牌 - 校验 loopback、Host、Origin/Referer、令牌和服务身份 - body 上限(state 16KB / permission 1MB) - 慢请求 10 秒超时;连接、请求头和字段均有上限 ### 3. CodeWhale catalog v2 + models.dev 实时同步 - model-catalog 从 31 扩到 49 条目,覆盖 CodeWhale ModelRegistry 全部已注册模型 - 缓存费率按厂商官网公布值(Xiaomi MiMo 2%、Z.AI GLM 18.6%、xAI Grok 15-20%) - 新增 backend/models-dev-sync.js:24h TTL 从 models.dev/catalog.json 拉取最新价格 - 三层查询:live cache > bundled seed > null(未知模型 honest 返回 null) ### 4. 权限桥统一 fail-safe - CodeWhale 授权桥在服务不可达、身份头错误、响应畸形、队列溢出或勿扰模式下统一返回 ask - 批量授权仅限当前会话,30 分钟滑动过期 - 新增 hook/pretool-hook.js:PreToolUse 前置拦截层,绕过 Claude Code PermissionRequest hook 已知回归 bug (#32493/#52822) ### 5. 计量与持久化加固 - transcript、会话目录、配置、计价缓存和计量状态全部改为有界读取 - 大 JSONL 使用固定内存分块扫描 - 计量状态使用无原型字典和有限数值清洗,阻断原型污染 - 配置 / 用量 / settings / 价格缓存采用私有权限和原子写 ## 测试 - 20 个核心测试文件全部通过 - 92 项 Windows 适配断言通过 - 语法检查、集成测试、安全测试、TOML round-trip 均通过 ## 文档 - 新增 CHANGELOG.md、CODEWHALE.md、SECURITY.md、AUDIT_REPORT.md、DEEP_AUDIT_REPORT.md - README 全面更新,详述 v0.1.1 改进亮点 Co-authored-by: purrfecto114-lgtm
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.
概要
在 v0.1.0 基础上完成 46 文件、+8378 / −7266 行的深度加固。核心改进分为五大方向:
1. 渲染进程安全加固
sandbox/contextIsolation/webSecurity全开nodeIntegration/webviewTag关闭2. 本地 HTTP 安全升级
3. CodeWhale catalog v2 + models.dev 实时同步
model-catalog从 31 扩到 49 条目,覆盖 CodeWhaleModelRegistry全部已注册模型backend/models-dev-sync.js:24h TTL 从models.dev/catalog.json拉取最新价格live cache > bundled seed > null(未知模型 honest 返回 null)4. 权限桥统一 fail-safe
askhook/pretool-hook.js:PreToolUse 前置拦截层,绕过 Claude CodePermissionRequesthook 已知回归 bug (#32493 / #52822)5. 计量与持久化加固
测试
新增文件
backend/models-dev-sync.jsbackend/currency.jsbackend/safe-json.jsbackend/shell-quote.jsbackend/window-security.jsbackend/metering-state.jshook/pretool-hook.jsproviders/aider.jsscripts/package-linux.shscripts/package-win.shSECURITY.mdAUDIT_REPORT.mdDEEP_AUDIT_REPORT.mdCHANGELOG.mdCODEWHALE.md文档
.github/workflows/ci.yml的 CI 配置更新(新增 Windows 适配测试 job、lockfile 一致性检查)因 push token 权限限制未包含在本 PR 中。建议上游维护者直接更新 CI 配置,内容参考:破坏性变更
无。所有改动向后兼容,配置文件自动迁移。
Co-authored-by: purrfecto114-lgtm
🤖 Generated with Claude Code