BUG: 超出工作区(Windows·SMB映射驱动器)File operations judged as "out of workspace" #3749
Unanswered
arcqiufeng
asked this question in
Q&A
Replies: 3 comments 1 reply
|
你的根因分析基本正确,我在源码里也验证了: 临时 workaround:创建/打开工作区时直接用 UNC 路径( 你的修复建议(统一 Windows 路径形态后再比较)方向是对的,建议把它整理成正式的 bug 报告给维护团队,或直接提 PR。 |
1 reply
|
我也遇到了这个问题,希望官方能够采纳 |
0 replies
|
团队场景:工作区在 NAS/SMB 共享上(Windows 映射
复现
期望
影响多人团队 + 中央 NAS 是常见协作形态,SMB/共享工作区不是个例。 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
DSH 问题报告(Windows · SMB 映射驱动器):对当前工作区路径操作被判定为“超出工作区”
一、问题概述
在 Windows 上以网络共享(映射驱动器)路径创建 DSH 项目工作区后,在对当前工作区内的路径执行文件操作(读写/编辑等)时,被判定为“超出工作区”(out of workspace / 越界),导致操作被拒。
用户提供的是映射驱动器路径(如
Z:\...),DSH 内部将工作区解析为 UNC 路径(\\<server>\<share>\...),随后沙箱在对工作区边界进行判断时,对这两种路径形态的判断结果不一致,从而误判当前路径越界。二、环境
process.platform === 'win32')Z:→\\<server>\<share>@deepseek-ai/dsh0.1.0-rc.7(npm 安装)三、根因分析
对本地安装的 DSH 源码(
node_modules/@deepseek-ai/dsh-*)排查,问题与工作区路径的规范化方式有关。@deepseek-ai/dsh-fs-local/lib/index.js的resolveLocalTarget()使用node:fs/promises的realpath()解析路径:在 Windows 上,对映射盘(
Z:\...)执行realpath()会得到其底层 UNC 规范路径(\\<server>\<share>\...)。当工作区根被规范化为 UNC,而某些操作/路径仍以盘符(Z:\...)形态出现时,沙箱的“工作区包含/边界”判断(如dsh-fs-local的contains()等)在两种形态之间比较可能出现不一致,从而把工作区内的路径误判为越界(超出工作区)。说明:以上为基于本地源码的初步定位,最终以上报后维护团队确认的根因为准。
四、影响与一连串后果
该问题会引发一连串连锁后果,具体如下:
Z:\...)和以 UNC(\\<server>\<share>\...)两种形态出现时,工作区边界判断结果不一致,造成“明明在工作区内却报越界”的困惑。/开头的路径)不识别 UNC,会把工作区路径报为“not an absolute path”。此为上述问题的连锁表现,属第三方插件行为,并非官方 DSH 的功能缺陷,仅用于说明问题影响范围。五、建议修复方向(供参考)
realpath结果保持一致,使边界判断与用户所提供路径形态一致。六、复现步骤(供维护者复现)
net use Z: \\<server>\<share>)。Z:\<项目>\<子目录>)创建/打开一个 DSH 项目工作区。DSH Issue Report (Windows · SMB mapped drive): File operations on paths inside the current workspace are judged as "out of workspace"
1. Problem Summary
On Windows, after creating a DSH project workspace using a network-share (mapped drive) path, file operations (read/write/edit, etc.) on paths inside the current workspace are judged as "out of workspace" and rejected.
The user provides a mapped-drive path (e.g.
Z:\...); DSH internally resolves the workspace to a UNC path (\\<server>\<share>\...). When the sandbox later checks the workspace boundary, it evaluates the two path forms (drive letter vs UNC) inconsistently, so a path inside the workspace is misjudged as out of bounds.2. Environment
process.platform === 'win32')Z:→\\<server>\<share>@deepseek-ai/dsh0.1.0-rc.7(installed via npm)3. Root Cause Analysis
After inspecting the locally installed DSH source (
node_modules/@deepseek-ai/dsh-*), the issue relates to how the workspace path is canonicalized.resolveLocalTarget()in@deepseek-ai/dsh-fs-local/lib/index.jsresolves paths withrealpath()fromnode:fs/promises:On Windows, calling
realpath()on a mapped drive (Z:\...) returns its underlying canonical UNC path (\\<server>\<share>\...). When the workspace root is canonicalized to UNC but some operations/paths still appear in drive-letter form (Z:\...), the sandbox's "workspace containment/boundary" checks (e.g.contains()indsh-fs-local) may compare the two forms inconsistently, misjudging an in-workspace path as out of bounds.Note: the above is a preliminary localization based on local source; the root cause confirmed by the maintainers after escalation takes precedence.
4. Impact and Chain of Consequences
This issue triggers a chain of consequences, as follows:
Z:\...) versus UNC form (\\<server>\<share>\...), yields inconsistent workspace-boundary results, causing confusion ("why is an in-workspace path reported as out of bounds")./) and therefore do not recognize UNC, reporting the workspace path as "not an absolute path". This is a knock-on effect of the above issue and is third-party plugin behavior — it is not an official DSH functionality defect, and is mentioned only to illustrate the extent of the impact.5. Suggested Fix (for reference)
realpathresult consistent on Windows, so the boundary check matches the path form the user provided.6. Reproduction Steps (for maintainers)
net use Z: \\<server>\<share>).Z:\<project>\<subdir>).All reactions