From 7a65410cecebe9b25af55c8988c388c3cc9ee2a7 Mon Sep 17 00:00:00 2001 From: weichen Date: Wed, 30 Sep 2026 16:34:01 +0000 Subject: [PATCH] Pin backend gitlink to the blobstore id validation fix Why: the 2026-09-30 deep security scan triage left one actionable finding: backend Local.Put joined the HTTP-supplied artifact id into the store directory unsanitized (reachable via UpdateArtifactContent path parameter), and Get/Delete took stored refs unvalidated. Backend PR #22 adds validID on Put plus a directory-containment check on Get/Delete with unit tests. Evidence: backend go vet ./... and go test -count=1 ./... pass (3 new blobstore test groups green); Dev make test combined verification exit 0 across core+backend+frontend+ui+agentcmd (log tail shows test-ui 37/37, agentcmd ok); gitlink pinned to backend main f98dc1d after confirming it already contains the chat-process pointer 76d64a1 (no regression). Impact: modules/backend gitlink only (+task card); no Dev-repo code change. Refs: .task/fix-blobstore-id-hardening.md, backend PR #22 --- .task/fix-blobstore-id-hardening.md | 14 ++++++++------ modules/backend | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.task/fix-blobstore-id-hardening.md b/.task/fix-blobstore-id-hardening.md index 875b3de3..4beaffeb 100644 --- a/.task/fix-blobstore-id-hardening.md +++ b/.task/fix-blobstore-id-hardening.md @@ -6,11 +6,13 @@ - 权威仓:ssh://git@git-ssh.u1680832.nyat.app:31411/weichen/Agent-System-Dev.git;目标分支:main;R0(initial_base_sha)= eb1877b3f707fc5bc6e59cd531e6d9d69424129b - 工作区:/home/weichen/projects/Agent-System-Dev-wt-fix-blobstore-id-hardening(worktree);分支:fix/blobstore-id-hardening -- 授权与交付终点:<本次允许的动作与终点;未授权事项写明> +- 授权与交付终点:落地 Mimosa 深度扫描甄别后的唯一实质修复——backend blobstore 对象 id 边界校验,并经组合验证后钉入 gitlink;终点为两个 PR(backend + Dev gitlink)合入后回收 worktree。 ## 目标与非目标 -<预期结果、受影响入口/模块/契约;明确不做什么。> +- 目标:backend `internal/blobstore` 增加 `validID`(Put 拒绝空/`.`/`..`/含路径分隔符/绝对路径/NUL 的 id)与 `contains`(Get/Delete 对入库引用做目录包含性检查),补齐单测;Dev 仓 gitlink 钉入 backend 合入后的新 main。 +- 非目标:不改 store/server 调用方与 API 形态;不做 S3 等其他实现;不动扫描报告其余误报项(已逐个核实为参数化查询)。 +- 依据:2026-09-30 Mimosa deep 扫描(封印 sha256:78acce…)甄别后唯一实质项;`store.UpdateArtifactContent` 的 HTTP 路径参数直达 `Put`,穿越面真实可达。 ## 同步记录 @@ -18,8 +20,8 @@ |---|---|---|---| | 启动 | eb1877b3f707fc5bc6e59cd531e6d9d69424129b | eb1877b3f707fc5bc6e59cd531e6d9d69424129b | 2026-09-30T16:28:31Z | -## 结果与验证(完成后填写) +## 结果与验证 -- 结果: -- 验证: -- 影响与剩余项: +- 结果:backend PR #22(commit 4fd0402)合入,backend main=f98dc1d;Dev gitlink 钉至 f98dc1d。跨仓顺序已核:backend main 先吸收了并行会话的 76d64a1(PR #21),钉入无回退。 +- 验证:backend `go vet ./...` + `go test -count=1 ./...` 全绿;新增 blobstore 三组单测(不安全 id 拒绝且目录零残留、正常 Put/Get/Delete 往返、目录外引用 Get/Delete 拒绝);Dev 仓 `make test` 组合验证全链 exit 0(日志尾部 test-ui 37/37、agentcmd ok)。 +- 影响与剩余项:影响面仅 backend `internal/blobstore`,纯文件名 id(现网唯一形态)行为不变;剩余项为依赖 CVE 明细(扫描报 3 包 34 条通告未出清单,需子仓 govulncheck/npm audit,另立任务)。 diff --git a/modules/backend b/modules/backend index 76d64a1f..f98dc1dd 160000 --- a/modules/backend +++ b/modules/backend @@ -1 +1 @@ -Subproject commit 76d64a1f75ea81e508355209579861a8cd3aafef +Subproject commit f98dc1ddd4ab82f915e949c47f5ab35c49c78ac6