加固:executor 根文件系统只读,tmpfs 提供可写点

- agent-executor 增加 read_only: true,AI 命令无法往镜像层(/usr、/root 等)写文件做持久化/篡改。

- tmpfs 配 /tmp、/var/tmp、/run。/run 必须有:隔离 wrapper 要在 /run/agent-exec 建私有 anchor/rundir,只读下 mkdir 报 EROFS 会中断每条命令(已实测:Linux + Docker 29 重建后 ReadonlyRootfs=true,session 隔离与技能执行均正常,touch 根目录报 Read-only file system、ls /workspace/tasks 仅见本会话)。

- ARCHITECTURE §6 同步。
This commit is contained in:
2026-09-11 21:11:42 +08:00
parent 4e8560982f
commit 3e389747c8
2 changed files with 13 additions and 0 deletions
+11
View File
@@ -71,6 +71,17 @@ services:
- no-new-privileges:true
# 实测 Docker 29 (Ubuntu) 需 unconfined 才能使用 mount/unshare 系统调用
- apparmor=unconfined
# 根文件系统只读:AI 命令无法往镜像层(/usr、/root 等)写文件做持久化/篡改;
# 合法写盘另走 tmpfs 与 bind 卷(handleExec 已把 HOME/TMPDIR 指向 /tmp)。
read_only: true
tmpfs:
- /tmp
- /var/tmp
# /run 必须可写:隔离 wrapper 要在 /run/agent-exec 下建私有 anchor/rundir,
# 否则 read_only 下 mkdir 报 EROFS,每条命令直接中断。
- /run
networks:
- agent-internal