[Security] workspace-write fs fence silently grants <drive>:\tmp as a writable root on Windows #2562
maycuatroi1
started this conversation in
General
Replies: 2 comments
|
Thanks for the detailed security report — confirmed. Fixed in the guntur-d/deepseek-harness fork (PR #7): |
0 replies
|
感谢详细的安全报告,已确认。已在 guntur-d/deepseek-harness fork 修复(PR #7): |
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.
Security report:
workspace-writefs fence silently grants<drive>:\tmpas a writable root on WindowsResearcher: Binhna. Defensive research, all validation local with minimal-impact marker writes.
Summary
writableRoots()(packages/sandbox/sandbox/src/roots.ts:52-55at commit47f9438, the currentmasterHEAD) unconditionally includes the POSIX literal'/tmp'in theworkspace-writeallow-list:On Windows,
realpathSync.native('/tmp')resolves a drive-rooted path against the process's current drive. When<drive>:\tmpexists (installers and users create it;C:\tmppre-existed on my validation host),canonicalPathreturnsC:\tmp, and the in-process fs fence (SandboxedFileSystem.checkedTarget,packages/fs/fs-sandbox/src/index.ts:126-148) admits any target under it. Thefs/str_replace_editorwrite tools can then write anywhere underC:\tmpwith no approval, outside the workspace and outside the per-user%TEMP%the mode documents.Notably
C:\tmpon default installs is modifiable by all Authenticated Users, so this is a machine-shared, cross-user-visible staging area - and the ACL sandbox denies writes there from confined shell commands, so the two write planes disagree on the same path.Reproduction (validated on Windows 11, build 26200)
Called the repository's own
writableRootsandisPathUnderdirectly from source, with policy{ mode: 'workspace-write', workspaceRoot: <poc-workspace> }:Precondition:
C:\tmpexists (recorded pre-existing on the host; not created for the test). While the directory is absent the literal stays inert, so the widening is silent and environment-dependent.Impact
workspace-write(the default preset) on a machine where<cwd-drive>:\tmpexists.git status, and are shared with other local users. IfC:\tmpis onPATH(common for users who create it for scratch scripts), planted executables shadow commands in the user's normal shell.Suggested fix
Gate the host-temp literal to POSIX platforms in
writableRoots(Windows keeps exactly{workspaceRoot, os.tmpdir()}), with a deterministic cross-platform test that mocksos.tmpdir()so the two temp roots stay distinguishable. A ready branch with the fix, tests, and an Agent Note (following repo conventions, all local gates run: vitest roots/fs-sandbox, note-format/classification, md-wrap/md-links, translation-pairing, tsc -b, pre-push typecheck):https://github.com/maycuatroi1/deepseek-harness/tree/fix/win32-tmp-literal-writable-root
Filed as a discussion per CONTRIBUTING.md (external PRs not accepted at the moment); happy to rework or hand the patch over in whatever form is easiest for maintainers.
Context from the same review (defended surfaces, negative results)
For completeness, the same validation run confirmed the Windows ACL restricted-token sandbox fails closed against direct out-of-workspace writes, WSL interop (
Wsl/Service/CreateInstance/E_ACCESSDENIED, cold and warm distro),\\wsl.localhostUNC access, and the Docker Desktop engine named pipe - all underworkspace-writeon the same host.All reactions