fix(executor): resolveInTask 把绝对路径 /tmp 重写为 <taskDir>/.tmp——对齐 executor 容器 bind(terminal 写 /tmp/x,core 侧即 .tmp/x),read/write/edit/list/copy 文件工具直接可达 terminal 临时产物; safegaurd 越界校验原样兜底,normalize 先行无穿越风险

This commit is contained in:
2026-10-18 15:42:44 +08:00
parent d5e1ff374f
commit 3df7505fb1
+5
View File
@@ -24,6 +24,11 @@ function resolveInTask(taskDir, p) {
let abs;
if (path.isAbsolute(p)) {
abs = path.normalize(p);
// /tmp → <taskDir>/.tmp:与 executor 容器的 bind 对齐(容器内 /tmp 即会话 .tmp,
// terminal 写 /tmp/x,core 侧实体在 <taskDir>/.tmp/x)。先 normalize 再重写,
// 重写后仍走下方越界校验,无穿越风险。
if (abs === '/tmp') abs = path.join(path.resolve(taskDir), '.tmp');
else if (abs.startsWith('/tmp/')) abs = path.join(path.resolve(taskDir), '.tmp', abs.slice(5));
} else {
abs = path.resolve(taskDir, p);
}