Repository navigation
Add a VS Code integration for LoopForge workflows - #174
Zhong-Chenchen wants to merge 4 commits into
Conversation
|
💬 结论:Comment(仅意见,不阻塞也不批准) 审查 head 整体方向不错:扩展只通过现有 1. Go 版本升级提交已与 main 重复 2. 非回环地址允许明文 HTTP,Bearer token 会明文传输 3. 轮询无条件执行,且每次拉取全量 run 列表 4. 受限(Untrusted)工作区下的 projectId/workflowId 预设 5. 工作流输入里附带本机绝对路径 6. 草稿原因:完成后工作区被回收 可选小点:
验证
|
fx-kurumi
left a comment
There was a problem hiding this comment.
结论:Request changes
审查的 head 是 daabaec。上一轮我在这里只发了 Comment;复核后,下面这条属于凭据泄露问题,改为阻塞项。
[P1] 非回环地址的 HTTP 也会把 API token 明文发出去
vscode-extension/lib/client.js:16:normalizeBaseUrl 只限制协议为 http:/https:,不检查主机是不是回环地址。:39 随后对任何 baseUrl 都附带 Authorization: Bearer <token>,这个 token 取自 SecretStorage。README 第 30 行只是"建议远程用 HTTPS",代码没有强制。只要用户把 loopforge.serverUrl 配成 http://<内网或公网主机>:8090,同一网段或链路上的任何人都能拿到这个平台 token;它有用户的完整 API 权限,可以 approve/取消运行等。
复现(当前 head):
node -e "const {normalizeBaseUrl}=require('./vscode-extension/lib/client.js');console.log(normalizeBaseUrl('http://remote.example:8090'))"
# => http://remote.example:8090 (被接受)
(没有真正向任何远端发送 token。)
建议:只对 localhost / 127.0.0.0/8 / ::1 放行 http:,其他主机一律要求 https: 并给出清楚的报错。如果确实需要支持内网 HTTP,就加一个显式的 machine-scope 开关(例如 loopforge.allowInsecureHttp),默认关闭。另外在 test/ 里补上 "远端 http 拒绝 / 回环 http 允许" 两条用例。
验证
node --test vscode-extension/test/*.test.js:10/10 通过- 上面那段 URL 边界调用:
http://remote.example:8090、http://10.0.0.5:8090都被接受 - 限制:这是 VS Code 扩展,本机没有 VS Code 宿主,所以没有界面截图;这个结论来自代码和函数调用,不代表扩展界面已经验收。
| if (!raw) throw new LoopForgeError('LoopForge server URL is empty. Set loopforge.serverUrl first.'); | ||
| let url; | ||
| try { url = new URL(raw); } catch (_) { throw new LoopForgeError(`Invalid LoopForge server URL: ${raw}`); } | ||
| if (!['http:', 'https:'].includes(url.protocol)) { |
There was a problem hiding this comment.
[P1] 这里只检查协议,不检查主机。http://remote.example:8090 也会被接受,之后 request() 会对它附带 Authorization: Bearer <token>,token 走明文。建议非回环主机强制 https(或者加一个默认关闭的 machine-scope 开关),并补测试。
|
LoopForge PR Review Bot
Checks performed (isolated worktree, Go 1.26.11 matching go.mod):
Missing to resolve: wait for the remaining 4 in-progress checks ( |
复审 head
|
Re-reviewed at current head: the blocking issue is fixed. See the latest fx-kurumi re-review comment.
|
LoopForge PR Review — head
|
What changed
Adds a standalone VS Code extension that connects to an existing LoopForge platform. Users can start a workflow with the active file and selected text, inspect runs and logs, respond to approvals, and open artifacts or available workspace files and diffs.
Remote platform URLs require HTTPS; plain HTTP is accepted only for localhost, 127.0.0.0/8 and ::1 to protect API tokens.
Also updates the Go toolchain and Docker build image from 1.26.10 to 1.26.11 to fix GO-2026-6859, which blocked the platform vulnerability scan.
Closes #113. This is a draft because successful ordinary workflows may have their workspace reclaimed immediately, so reopening a diff after completion is not guaranteed.
Scope
Compatibility
Go builds now require Go 1.26.11 or newer. Desktop VS Code 1.85+; requires a reachable LoopForge platform API. The extension stores its API token in VS Code SecretStorage and does not upload or mount the local project. Workspace files and diffs depend on platform workspace availability; saved artifacts are separate. See the extension README for setup and limitations.
Validation
node --test --test-reporter=spec test/*.test.jsinvscode-extension: passed, including remote HTTP rejection and loopback HTTP acceptance.go test -count=1 -v ./vscode-extension/acceptance: passed against the latest base using an in-memory test database and real HTTP handlers/workflow engine.python3 scripts/check-public.py: passed.go run golang.org/x/vuln/cmd/govulncheck@v1.9.0 ./...with Go 1.26.11: passed, no reachable vulnerabilities found.go vet, local host validation/install/e2e scripts, andscripts/scan-secrets.sh: not run for this change.Safety