You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Windows] workspace-write sandbox breaks Office/COM automation: DCOM-spawned WINWORD cannot create its %TEMP% work file
#13437
On Windows, when a session runs under the workspace-write file policy, Office COM automation deadlocks the agent: the DCOM-spawned WINWORD.EXE cannot create its temp work file (~WRD####.tmp) and raises the modal
Word cannot create the work file. Check the TEMP environment variable. (「Word 无法创建工作文件,请检查临时环境变量。」)
The modal blocks the automation thread, so the caller (ops_bash / run_code) hangs until its 120 s deadline and leaves a stray WINWORD.EXE behind. The same script under danger-full-access returns normally (PAGES=2 / WORDS=240 on a synthetic doc, PAGES=17 on the real one).
Observed upstream mechanism (from the packaged build, DSH Desktop 0.12.1)
Sandboxed children get a write-restricted primary token: createRestrictedProcess() → CreateProcessAsUserW(options.token, …), token built by createRestrictedToken(currentToken, 13, …) (13 = DISABLE_MAX_PRIVILEGE | LUA_TOKEN | WRITE_RESTRICTED), restricting SIDs = {logon SID, Everyone, capability SID}.
Measured with that exact token shape on this host (real file creation, not AccessCheck):
target
result
real %TEMP% (DACL: SYSTEM / Administrators / user only)
❌ denied
session temp dir (has the capability SID)
✅ allowed
workspace root (has the capability SID)
✅ allowed
a workspace subfolder with a legacy non-inherited DACL (no capability SID)
❌ denied
Word's work file is a write to the real %TEMP%, so it fails. Because COM activates same-user servers with the client's token, the restricted token (and its restricting SIDs) is what the Word server ends up running under.
Any COM server that creates work files in %TEMP% (Word, Excel, PowerPoint, Visio), and third-party GUI apps launched via COM from a sandboxed session. Typical agent tasks — page counting, DOCX→PDF, template filling — hang instead of erroring.
Suggested directions
Document that Office/COM automation is unsupported under workspace-write (or fail fast with an actionable error instead of hanging).
Better: give GUI/COM servers of a sandboxed session a writable %TEMP%. Hard part: RPCSS starts the server with the user's profile environment, so a session TEMP cannot be injected — a productised redirect or a dedicated "Office automation in sandbox" switch would be needed.
Regardless: add a timeout + stray-process cleanup around COM automation so the agent never hangs 120 s.
Environment
DSH Desktop 0.12.1 (Windows x64) · Windows 11 25H2, 10.0.26200.9974 · Microsoft 365 ClickToRun x64 16.0.20527.20150 · non-elevated account (Medium IL) · repro 100%.
Full report with the minimal pages.ps1 repro lives in dataelement/dsh-desktop#900 (the desktop wrapper's tracker, since this repo's Issues are disabled). Happy to re-test against a patched @deepseek-ai/dsh-sandbox-windows-acl.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Symptom
On Windows, when a session runs under the
workspace-writefile policy, Office COM automation deadlocks the agent: the DCOM-spawnedWINWORD.EXEcannot create its temp work file (~WRD####.tmp) and raises the modalThe modal blocks the automation thread, so the caller (
ops_bash/run_code) hangs until its 120 s deadline and leaves a strayWINWORD.EXEbehind. The same script underdanger-full-accessreturns normally (PAGES=2 / WORDS=240on a synthetic doc,PAGES=17on the real one).Observed upstream mechanism (from the packaged build, DSH Desktop 0.12.1)
Sandboxed children get a write-restricted primary token:
createRestrictedProcess()→CreateProcessAsUserW(options.token, …), token built bycreateRestrictedToken(currentToken, 13, …)(13 = DISABLE_MAX_PRIVILEGE | LUA_TOKEN | WRITE_RESTRICTED), restricting SIDs = {logon SID, Everyone, capability SID}.Measured with that exact token shape on this host (real file creation, not AccessCheck):
%TEMP%(DACL: SYSTEM / Administrators / user only)Word's work file is a write to the real
%TEMP%, so it fails. Because COM activates same-user servers with the client's token, the restricted token (and its restricting SIDs) is what the Word server ends up running under.Honest caveat: I could not directly observe the inherited token — a hand-built
CreateProcessAsUserrestricted child always dies with0xC0000142on this host (same domain as [Bug][Windows] workspace-write 沙箱下所有子进程立即以 0xC0000142 退出(宿主以高完整性级别运行时) dataelement/dsh-desktop#832). The normal-token vs sandboxed-parent contrast is the evidence.Impact
Any COM server that creates work files in
%TEMP%(Word, Excel, PowerPoint, Visio), and third-party GUI apps launched via COM from a sandboxed session. Typical agent tasks — page counting, DOCX→PDF, template filling — hang instead of erroring.Suggested directions
workspace-write(or fail fast with an actionable error instead of hanging).%TEMP%. Hard part: RPCSS starts the server with the user's profile environment, so a session TEMP cannot be injected — a productised redirect or a dedicated "Office automation in sandbox" switch would be needed.Environment
DSH Desktop 0.12.1 (Windows x64) · Windows 11 25H2, 10.0.26200.9974 · Microsoft 365 ClickToRun x64 16.0.20527.20150 · non-elevated account (Medium IL) · repro 100%.
Full report with the minimal
pages.ps1repro lives in dataelement/dsh-desktop#900 (the desktop wrapper's tracker, since this repo's Issues are disabled). Happy to re-test against a patched@deepseek-ai/dsh-sandbox-windows-acl.All reactions