Browse Source

【文档】细化 x-cmd 沙箱可用性边界

实测确认 landlock 沙箱下 x-cmd 只读调用(内置模块、已启用/已缓存包)
可用,仅安装/启用新包受限(x env use 报权限不够、x env ls 静默空);
文档补充能力边界与解决路径。
PJ568 3 tháng trước cách đây
mục cha
commit
e9dbaa62e2
3 tập tin đã thay đổi với 3 bổ sung và 3 xóa
  1. 1 1
      README.md
  2. 1 1
      README.zh.md
  3. 1 1
      defaults/AGENTS.md

+ 1 - 1
README.md

@@ -93,7 +93,7 @@ jq . data.json                # bare command: enabled packages are symlinked to
 - Newly installed tools are invoked with the `x <pkg>` prefix in the current session; bare commands become available after the container restarts
 - Newly installed tools are invoked with the `x <pkg>` prefix in the current session; bare commands become available after the container restarts
 - Tools come from the x-cmd package source (Alibaba Cloud OSS, reachable from mainland China) and support version management (`x env use node=v20`)
 - Tools come from the x-cmd package source (Alibaba Cloud OSS, reachable from mainland China) and support version management (`x env use node=v20`)
 
 
-**Sandbox caveat**: x-cmd writes to `~/.x-cmd.root` (inside the data volume) to run. The file sandbox (workspace-write) only permits writes inside the session workspace plus `/tmp`, so this directory is not writable: under a bwrap sandbox `x` refuses to start with `folder defined ___X_CMD_ROOT specified is not writable`; under the Landlock sandbox (this image ships no bwrap) `x` starts but every write — `x env use`, `x env ls` — fails with `permission denied`. Either way the agent must request full permissions (approval), or pick `/home/node` as the session workspace, to use x-cmd normally.
+**Sandbox caveat**: x-cmd writes to `~/.x-cmd.root` (inside the data volume) to run. The file sandbox (workspace-write) only permits writes inside the session workspace plus `/tmp`, so this directory is not writable: under a bwrap sandbox `x` refuses to start with `folder defined ___X_CMD_ROOT specified is not writable`; under the Landlock sandbox (this image ships no bwrap) `x` starts and read-only use works — built-in modules (`x version`, `x passwd`) and already-enabled or cached packages (`x <pkg>`, symlinked bare commands) — but installing/enabling new packages fails: `x env use` errors with `permission denied`, `x env ls` silently returns empty. To install new tools the agent must request full permissions (approval), or pick `/home/node` as the session workspace.
 
 
 For the in-container agent environment guide, see `AGENTS.md` in the data volume (auto-loaded by dsh sessions).
 For the in-container agent environment guide, see `AGENTS.md` in the data volume (auto-loaded by dsh sessions).
 
 

+ 1 - 1
README.zh.md

@@ -93,7 +93,7 @@ jq . data.json                # 裸命令:已启用包已软链至 /usr/local/
 - 新安装的工具本会话用 `x <pkg>` 前缀调用,容器重启后裸命令可用
 - 新安装的工具本会话用 `x <pkg>` 前缀调用,容器重启后裸命令可用
 - 工具源为 x-cmd 包源(阿里云 OSS,国内可达),支持版本管理(`x env use node=v20`)
 - 工具源为 x-cmd 包源(阿里云 OSS,国内可达),支持版本管理(`x env use node=v20`)
 
 
-**沙箱注意**:x-cmd 运行需写 `~/.x-cmd.root`(数据卷内)。文件沙箱(workspace-write)仅放行会话工作区 + `/tmp`,该目录不可写——bwrap 沙箱下 `x` 启动即报 `folder defined ___X_CMD_ROOT specified is not writable`;本镜像无 bwrap,走 landlock 沙箱,`x` 能启动但 `x env use`/`x env ls` 等写操作报 `权限不够` 失败。两种情况都需 agent 申请完整权限(审批)后才能正常使用,或将工作区选在 `/home/node` 下。
+**沙箱注意**:x-cmd 运行需写 `~/.x-cmd.root`(数据卷内)。文件沙箱(workspace-write)仅放行会话工作区 + `/tmp`,该目录不可写——bwrap 沙箱下 `x` 启动即报 `folder defined ___X_CMD_ROOT specified is not writable`;本镜像无 bwrap,走 landlock 沙箱,`x` 能启动且**只读调用可用**(内置模块 `x version`/`x passwd`,已启用/已缓存包的 `x <pkg>` 前缀与软链裸命令),但**安装/启用新包失败**:`x env use` 报 `权限不够`,`x env ls` 静默返回空。要装新工具,agent 需申请完整权限(审批),或将工作区选在 `/home/node` 下。
 
 
 容器内 agent 的环境指引见数据卷 `AGENTS.md`(dsh 会话自动加载)。
 容器内 agent 的环境指引见数据卷 `AGENTS.md`(dsh 会话自动加载)。
 
 

+ 1 - 1
defaults/AGENTS.md

@@ -25,7 +25,7 @@ x env which <pkg>         # 查看路径
 
 
 工具安装持久化在数据卷(~/.x-cmd.root),容器重启/重建后保留。
 工具安装持久化在数据卷(~/.x-cmd.root),容器重启/重建后保留。
 
 
-- **沙箱警告**:x-cmd 运行需写 `~/.x-cmd.root`。文件沙箱(workspace-write)仅放行会话工作区 + `/tmp`,该目录不可写——bwrap 沙箱下 `x` 启动即报 `folder defined ___X_CMD_ROOT specified is not writable`;本容器(无 bwrap,走 landlock)下 `x` 能启动,但 `x env use`/`x env ls` 等写操作报 `权限不够` 失败。两种情况都需申请完整权限(审批通过)后才能正常使用,或将工作区选在 `/home/node` 下。
+- **沙箱警告**:x-cmd 运行需写 `~/.x-cmd.root`,文件沙箱(workspace-write)仅放行会话工作区 + `/tmp`,该目录不可写。bwrap 沙箱下 `x` 启动即报 `folder defined ___X_CMD_ROOT specified is not writable`;本容器(无 bwrap,走 landlock)下 `x` 能启动,**只读调用可用**(内置模块如 `x version`/`x passwd`,已启用/已缓存包的 `x <pkg>` 前缀与软链裸命令均正常),但**安装/启用新包受限**:`x env use` 报 `权限不够` 失败,`x env ls` 静默返回空。需要装新包时申请完整权限(审批通过),或将工作区选在 `/home/node` 下。
 
 
 ## 限制
 ## 限制