Replies: 5 comments
根因(一行)模块: js
A/B 对照(同一个内置 runner、同一条命令行,只改一个变量)
变体 | restricting SID 列表 | Default DACL 追加的 trustee | 降 Low 完整性 | 结果
-- | -- | -- | -- | --
baseline(现状) | logon + Everyone + wsSid + tempSid | capability SID | 是 | ❌ 0xC0000142
nosids | logon + Everyone | capability SID | 是 | ❌ 0xC0000142
noli | logon + Everyone + wsSid + tempSid | capability SID | 否 | ❌ 0xC0000142
dacl | 不变 | Everyone | 是 | ✅ 0x00000000,cmd 输出 ok
daclboth | 不变 | capability SID + Everyone | 是 | ✅ 0x00000000
dacl + PowerShell 7.6.6 | 不变 | Everyone | 是 | ✅ 0x00000000,输出 ps7-ok
修复后如何验证
想请你们确认一个问题
想确认:在 Win11 上是否复现? 如果不复现,说明这是 Win10 上 Default DACL / 受限令牌的行为差异,也解释了为什么这个缺陷没有在你们的验证环境里暴露。 English summary On Windows 10 22H2 (19045), under the Root cause: Evidence: an A/B run of the shipped runner changing only that one variable — with Suggested fix: add |
|
Cross-referencing a second, independent root cause for this same exit code: #8721 (packaged desktop / GUI-subsystem host: the process that creates the restricted child must itself own a console; the mediator interpreter comes from The two are not mutually exclusive, and this thread currently has the upvotes — so a "fixed the DACL, still broken for some users" report is likely to arrive unless both are checked:
A quick discriminator, using the harness you already posted here: if the failure survives the Independent reproduction of the console-ownership case + workaround: Astral-Dream/dsh-windows-sandbox-0xC0000142-workaround#1 · CI-side occurrence of this exit code: sjh9714/dsh-win32#91 |
|
Thanks for the detailed write-up — the A/B table and the "问 Win11 是否复现" question are exactly the right things to ask. I ran the same experiment on Windows 11 26200 (registry: Result: I cannot reproduce the capability-SID failure on 26200Same built-in runner, same command line, only the mode changed:
The restriction was genuinely in force, so this is not a "sandbox silently did nothing" artifact:
Why "Default DACL = capability SID" is not a substitution
So the capability SID is added on top of The most likely difference between our machines: mine is an elevated administrator token, whose ambient Default DACL carries SYSTEM + Administrators. If your failing token's ambient Default DACL lacks both, appending a capability SID cannot rescue it and only an One decisive run, if you are willingOn the failing Win10 19045 box, in read-only mode, print the restricted child's Default DACL: $env:ELECTRON_RUN_AS_NODE='1'
Start-Process <app-image> -ArgumentList '--expose-internals "<…>\dsh-sandbox-windows-acl\lib\runner.js" --workspace <ws> --temp <tmp> --mode read-only -- <node.exe> <dump-default-dacl.mjs>'
I left the probe sources in #8721, and both threads now cross-reference each other. Either way, please keep the |
|
直接回答你的问题,并且要分两层说,因为第一层只是"是/否",第二层才是真正能解释"为什么你们的验证环境没暴露"的。 1. Win11 26200 上是否复现?在我这份条件下不复现。 我在 Windows 11 26200(注册表
三档全部成功、输出 我还把受限子进程自己的 Default DACL 打印出来(每档都是 4 条 ACE,"capability SID" 是追加而不是替换,这一点和你对 在 26200 上无论加不加 capability SID, 给你一条决定性判据,比我复述结论有用:在你那台失败机器上,跑 read-only 模式的受限子进程,打印它自己的 Default DACL——
(打印脚本我可以贴,或者你自己补两行 2. 但 26200 并非"不会出 0xC0000142"——我复现了,条件是换中介第 1 节全部是在我自己这个进程里实例化
( 这就是我怀疑"你们的验证环境为什么没暴露"的答案,而且它和 Windows 版本无关:
你上一轮说过 CLI 下 100% 正常、你手上的创建层用 顺带两条能缩小范围的实测(同一台 26200,中介固定为 GUI 镜像,只跑
3. 最小复现脚本
:: 会失败的那一行(GUI 子系统镜像当中介)
set ELECTRON_RUN_AS_NODE=1
"C:\...\DeepSeek Harness.exe" probe-dacl-mediate.mjs "D:\some\workspace"
:: 永远成功的那一行(console 子系统 node.exe 当中介)
"C:\...\dsh-primary-runtime\dependencies\node\bin\node.exe" probe-dacl-mediate.mjs "D:\some\workspace"
4. 和 #8721 的关系#8721 是"中介无控制台 + workspace-write ⇒ 0xC0000142"这条(我在那边贴了完整 2×2 和分步定位见 https://github.com/deepseek-ai/deepseek-harness/discussions/8721)。你这条是"Default DACL 的 trustee 用了 capability SID"。 我一开始把你们当成同一个缺陷的两条独立根因,现在改口:在 26200 上它们并不互相需要,而且在你的 A/B 里 |
|
已收到这条反馈。 |
Uh oh!
There was an error while loading. Please reload this page.
1、TL;DR
在 Windows 10 22H2 (19045) 上,DSH Desktop 0.2.0-rc.2 的 workspace-write 沙箱模式无法启动任何子进程——cmd.exe、where.exe、Windows PowerShell 5.1、PowerShell 7.6.6 全部以 0xC0000142 (STATUS_DLL_INIT_FAILED) 退出,没有任何 stdout/stderr。
同一台机器上 read-only 模式完全正常。
根因是受限令牌的 Default DACL 里挂的 trustee 是 capability SID(S-1-4-…),而不是 Everyone:
js
// @deepseek-ai/dsh-sandbox-windows-acl/lib/types-.js (AclSandbox.init())
setTokenDefaultDaclGrant(api, restrictedToken,
this.tempWriteSidPtr ?? this.writeSidPtr ?? worldSid); // ← 这一行
把这一个参数换成 worldSid(或在原有基础上再补一条 Everyone),workspace-write 立刻恢复正常(已实测 cmd.exe 与 PowerShell 7.6.6 均可正常运行)。
2. 复现
2.1 界面内复现(用户视角)
把会话的权限预设切到 workspace-write
执行任意命令,例如 cmd /c echo
实际返回(工具结果原文):
json
{
"kind": "foreground",
"exitCode": 3221225794, // = 0xC0000142
"signal": null,
"stdout": { "text": "", "truncated": false },
"stderr": { "text": "", "truncated": false },
"sandbox": { "mode": "workspace-write", "denied": false, "enforcement": "partial" }
}
注意 denied: false:这不是"被沙箱拒绝",而是进程根本没起来。
2.2 可脚本化复现(直接调用发行版自带的沙箱 runner)
不需要 GUI,直接调用 DSH 自带的 windows-acl runner,对照组与实验组只差一个 --mode:
powershell
$exe = '<DSH 安装目录>\DeepSeek Harness.exe' # 例:D:\Forest\DeepSeek Harness.exe
$runner = '<DSH 安装目录>\resources\app.asar\dsh\node_modules@deepseek-ai\dsh-sandbox-windows-acl\lib\runner.js'
$ws = '<任意已存在的工作区目录>' # 例:D:\Forest\default-workspace
$env:ELECTRON_RUN_AS_NODE = '1'
$o = "$env:TEMP\o.txt"; $e = "$env:TEMP\e.txt"
function Run([string]$mode) {
$a = '--expose-internals "' + $runner + '" --workspace "' + $ws + '" --temp "' + $env:TEMP +
'" --mode ' + $mode + ' -- "C:\Windows\System32\cmd.exe" /c "echo ok"'
$p = Start-Process -FilePath $exe -ArgumentList $a -Wait -PassThru -NoNewWindow `
-RedirectStandardOutput $o -RedirectStandardError $e
'{0,-16} exit=0x{1:X8} out={2}' -f $mode, ($p.ExitCode -band 0xFFFFFFFF),
(([string](Get-Content $o -Raw)) -replace '\r?\n',' ').Trim()
}
Run 'read-only' # → exit=0x00000000 out=ok
Run 'workspace-write' # → exit=0xC0000142 out=
结果(本机实测,可复现率 100%):
代码块
read-only exit=0x00000000 out=ok
workspace-write exit=0xC0000142 out=
3、已排除项(避免重复排查)
不是 PowerShell 版本问题:cmd.exe、where.exe 同样失败;PowerShell 5.1 与 7.6.6 都失败
不是 .NET / CLR 初始化问题(5.1 曾是这个怀疑方向,但 cmd.exe 也会挂)
不是 Low 完整性级别(noli 变体仍然失败)
不是 restricting SID 列表(nosids 变体仍然失败)
不是工作区 ACL / 路径 / 当前目录(在没有任何 DSH ACE 与标签的全新空目录、以及把 cwd 设为 C:\Windows 的情况下同样失败)
不是 PATH / 沙箱 runner 本身(同一 runner 在 read-only 模式下正常)
不是 denied 类拒绝(工具元数据为 denied: false)
All reactions