From d2bbd2cd0f8a944c450b2386939f45c10c09dfd5 Mon Sep 17 00:00:00 2001 From: thzxx Date: Wed, 24 Jun 2026 21:29:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B7=A5=E4=BD=9C=E7=A9=BA=E9=97=B4?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=86=99=E6=93=8D=E4=BD=9C=E8=A2=AB=E6=8B=A6?= =?UTF-8?q?=E6=88=AA=20=E2=80=94=20allowedDirs=E9=81=97=E6=BC=8FblocklistE?= =?UTF-8?q?xemptions=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/tool-security.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/tool-security.ts b/src/main/tool-security.ts index b0d8793..baf5597 100644 --- a/src/main/tool-security.ts +++ b/src/main/tool-security.ts @@ -135,9 +135,10 @@ export function checkPathAllowed(targetPath: string, operation: 'read' | 'write' } if (operation === 'write') { + // 允许写入的目录:allowedDirs 白名单 + 黑名单豁免目录(工作空间等) const inAllowedDir = allowedDirs.some(dir => resolved === dir || resolved.startsWith(dir + path.sep) - ); + ) || isBlocklistExempt(resolved); if (!inAllowedDir) { return { ok: false, reason: `写操作被限制在允许的目录内。当前路径: ${resolved}` }; }