WeKnora/internal/agent
wizardchen adcb9fc10d fix(sandbox): 产物目录 bootstrap 降权,堵住 chown 跟随符号链接的容器内提权
会话级容器让「产物目录 bootstrap 以 root 执行」变成一条可复现的提权链:
沙箱账号拥有 /workspace,可以把产物目录换成指向 /etc 的符号链接;下一次
执行时 root 跑的 chown/chmod 会跟随链接,把 /etc 的属主交给沙箱账号,随后
删除重建 passwd 即可让该账号在下一次 exec 时解析成 uid 0——本 PR 刚做的
shell_exec 降权和文件操作降权会一并失效。一次性 docker run --rm 下两次执行
不共享文件系统,这条链走不通。真机验证过完整链路。

修法是让 bootstrap 和其它 exec 一样以沙箱账号运行:chown 对自己刚建的目录
是 no-op,对不属于自己的目标被内核拒绝。同时把 dockerExecUser 的空值兜底
从 root 改成 DefaultSandboxExecUser,漏传账号只会失去权限而非拿到权限,
也让三个后端对「空 User」的语义一致。

顺带订正若干过强的声明:find 只对路径最后一段不跟随符号链接,中间层的链接
仍由内核展开,因此 read_sandbox_file 的「拒绝符号链接」只覆盖路径本身指向
链接的情况;对应单测原先 mock 了一个真实 find 不会产生的返回值,改为断言
它实际覆盖的场景。文件头注释仍写着文件操作走 archive 接口,也一并更新。
2026-08-24 12:22:58 +08:00
..
approval refactor(terminology): rename user-facing tenant labels to workspace 2026-07-14 16:14:43 +08:00
memory feat(llm): add prompt-cache observability and wiki cache-friendly prompts 2026-07-23 19:17:30 +08:00
skills feat(sandbox) (#2301) 2026-08-10 21:28:20 +08:00
token feat(agent): enhance message consolidation and context management 2026-03-25 22:08:29 +08:00
tools fix(sandbox): 产物目录 bootstrap 降权,堵住 chown 跟随符号链接的容器内提权 2026-08-24 12:22:58 +08:00
act.go feat(memory): introduce long-term memory feature with i18n updates 2026-08-13 18:00:02 +08:00
const.go feat(sandbox) (#2301) 2026-08-10 21:28:20 +08:00
const_test.go feat(sandbox) (#2301) 2026-08-10 21:28:20 +08:00
engine.go feat(agent): report and attribute per-turn LLM token usage 2026-08-24 10:36:19 +08:00
engine_image_test.go feat: auto-describe MCP tool result images via VLM 2026-03-25 21:38:15 +08:00
engine_memory_test.go feat(memory): add cross-session long-term memory 2026-08-13 18:00:02 +08:00
engine_test.go refactor(agent): introduce modelcontext registry and fix handle-codec bugs 2026-07-27 11:05:43 +08:00
finalize.go feat(agent): report and attribute per-turn LLM token usage 2026-08-24 10:36:19 +08:00
finalize_image_requirement_test.go fix(chat): enforce retrieved image output in answers 2026-07-15 18:10:31 +08:00
image_requirement.go fix(chat): enforce retrieved image output in answers 2026-07-15 18:10:31 +08:00
langfuse_test.go refactor(agent): introduce modelcontext registry and fix handle-codec bugs 2026-07-27 11:05:43 +08:00
observe.go feat(sandbox) (#2301) 2026-08-10 21:28:20 +08:00
observe_test.go feat(sandbox) (#2301) 2026-08-10 21:28:20 +08:00
prompts.go feat(sandbox) (#2301) 2026-08-10 21:28:20 +08:00
prompts_shell_test.go feat(sandbox) (#2301) 2026-08-10 21:28:20 +08:00
prompts_wiki.go Remove redundant Wiki operation log 2026-07-28 11:18:33 +08:00
prompts_wiki_test.go refactor(agent): introduce modelcontext registry and fix handle-codec bugs 2026-07-27 11:05:43 +08:00
think.go refactor(agent): introduce modelcontext registry and fix handle-codec bugs 2026-07-27 11:05:43 +08:00
turn_usage_test.go feat(agent): report and attribute per-turn LLM token usage 2026-08-24 10:36:19 +08:00