From 3df7505fb1a01026e17cc551a5e857ac9c94fe34 Mon Sep 17 00:00:00 2001 From: kicer Date: Sun, 18 Oct 2026 15:42:44 +0800 Subject: [PATCH] =?UTF-8?q?fix(executor):=20resolveInTask=20=E6=8A=8A?= =?UTF-8?q?=E7=BB=9D=E5=AF=B9=E8=B7=AF=E5=BE=84=20/tmp=20=E9=87=8D?= =?UTF-8?q?=E5=86=99=E4=B8=BA=20/.tmp=E2=80=94=E2=80=94=E5=AF=B9?= =?UTF-8?q?=E9=BD=90=20executor=20=E5=AE=B9=E5=99=A8=20bind=EF=BC=88termin?= =?UTF-8?q?al=20=E5=86=99=20/tmp/x=EF=BC=8Ccore=20=E4=BE=A7=E5=8D=B3=20.tm?= =?UTF-8?q?p/x=EF=BC=89=EF=BC=8Cread/write/edit/list/copy=20=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=B7=A5=E5=85=B7=E7=9B=B4=E6=8E=A5=E5=8F=AF=E8=BE=BE?= =?UTF-8?q?=20terminal=20=E4=B8=B4=E6=97=B6=E4=BA=A7=E7=89=A9=EF=BC=9B=20s?= =?UTF-8?q?afegaurd=20=E8=B6=8A=E7=95=8C=E6=A0=A1=E9=AA=8C=E5=8E=9F?= =?UTF-8?q?=E6=A0=B7=E5=85=9C=E5=BA=95=EF=BC=8Cnormalize=20=E5=85=88?= =?UTF-8?q?=E8=A1=8C=E6=97=A0=E7=A9=BF=E8=B6=8A=E9=A3=8E=E9=99=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/server/tools/executor.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/server/tools/executor.js b/app/server/tools/executor.js index 747cef0..e8e9ce6 100644 --- a/app/server/tools/executor.js +++ b/app/server/tools/executor.js @@ -24,6 +24,11 @@ function resolveInTask(taskDir, p) { let abs; if (path.isAbsolute(p)) { abs = path.normalize(p); + // /tmp → /.tmp:与 executor 容器的 bind 对齐(容器内 /tmp 即会话 .tmp, + // terminal 写 /tmp/x,core 侧实体在 /.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); }