feat(web): 新增 Web 前端与 Electron 桌面应用,增强 Gateway 模块#520
feat(web): 新增 Web 前端与 Electron 桌面应用,增强 Gateway 模块#520phantom5099 merged 36 commits into1024XEngineer:mainfrom
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
| let url = `${wsBase}${normalizedEndpoint}` | ||
| if (token) { | ||
| const separator = url.includes('?') ? '&' : '?' | ||
| url = `${url}${separator}token=${encodeURIComponent(token)}` |
There was a problem hiding this comment.
buildWSURL() 将鉴权 token 放在 URL query(?token=)里。该模式会把密钥暴露给代理日志、错误上报、历史记录和调试工具,属于敏感信息泄露风险。建议改为:连接建立后立即通过 gateway.authenticate 在消息体传 token,或使用受控 header/cookie 通道,不在 URL 携带凭据。
| /** 暴露安全 API 到渲染进程 */ | ||
| contextBridge.exposeInMainWorld('electronAPI', { | ||
| /** 获取认证 Token */ | ||
| getToken: () => ipcRenderer.invoke('gateway:getToken'), |
There was a problem hiding this comment.
预加载层直接向渲染进程暴露 getToken()。一旦渲染层发生 XSS/供应链注入,攻击者可直接读取长期凭据。建议不要把 token 暴露给 renderer;改为由主进程代发鉴权请求(renderer 仅拿到会话态/短期授权结果)。
| @@ -0,0 +1,8 @@ | |||
| { | |||
There was a problem hiding this comment.
PR 引入了本地构建缓存产物(.vite/deps),同时还提交了 web/dist/index.html。这类生成文件易陈旧且会制造噪声,和源码/文档状态不一致。建议移除生成产物并通过 .gitignore 统一忽略,仅保留源码与可复现构建配置。
|
@xgopilot 对于这个PR的review提到的有关安全性的问题,整理成一个合规中文待办issue提交到仓库 |
|
codeagent is processing your request, please wait a moment... |
处理结果已根据 PR #520 的 review 安全反馈,整理并提交合规中文待办 Issue: Issue 内容摘要
未执行项
|
477e1fe to
69d8658
Compare
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
- eventBridge.ts: EventType 是 const 对象不能作为类型使用,改用 Set<string> - Sidebar.tsx: handleToggleSkill 补充 gatewayAPI null 守卫 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
增加前端自动检测重试次数(15→60),fetch 失败时重试而非直接放弃, 适配 Windows 上 Go 编译耗时较长的场景。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
.gitignore 已有对应规则但文件仍被跟踪,从 Git 索引中移除 web/.vite/ 和 web/dist/ 构建缓存。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This reverts commit ac5d1bb.
- 移除 rebase 后 recordingPort 中重复的 ListSessionTodos/GetRuntimeSnapshot 方法声明 - 新增 toSlash/isAbsolutePath 辅助函数,确保路径比较在 Windows 上使用统一的正斜杠格式 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- 移除 rebase 后 recordingPort 中重复的 ListSessionTodos/GetRuntimeSnapshot 方法声 明 - 新增 toSlash/isAbsolutePath 辅助函数,确保路径比较在 Windows 上使用统一的正斜杠格式 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…nto html_gui_build
概述
本 PR 为 NeoCode 新增了 Web 前端界面和 Electron 桌面应用支持,同时增强了 Gateway 模块的 RPC 协议和契约定义,为多端 UI 提供了完整的基础设施。
主要改动
1. Web 前端应用(React + TypeScript + Vite)
2. Electron 桌面应用
3. Gateway 模块增强
protocol/jsonrpc.go,优化 JSON-RPC 协议处理逻辑bootstrap.go,改进 Gateway 启动流程和依赖注入validate.go,添加更严格的参数校验security.go中新增安全相关逻辑rpc_dispatch_test.go等测试文件,提高测试覆盖率4. CLI 层改进
gateway_runtime_bridge.go,优化 Gateway 与 Runtime 的桥接逻辑gateway_runtime_bridge_test.go测试覆盖5. 文档更新
docs/gateway-compatibility.md,说明版本兼容性6. 其他改进
repo_hooks.go及平台特定实现)技术栈
测试
向后兼容性
检查清单
link #529