[Bug][Windows] workspace-write leaves a permanent Low integrity label on the project, breaking every other tool used on it — several reports, still unchanged in 0.2.0-rc.2 #8312
Replies: 3 comments 2 replies
|
我服了哈哈哈, 可惜没能早点看到你, 这个问题折腾死我了. |
|
可以先试试我的patch...几天前上0.1.7写的 今天无聊逛社区发现一堆人反馈以为0.2.0没问题了结果还是没解决 |
|
Thanks — this is the half of the backend the other threads do not describe, and it is worth separating what can be settled from the source here from what only a Windows machine can settle. What the shipped source does say (all read from
Your three asks are the right ones, and the ordering matters: (1) revoking the grant when the sandbox is done is a core decision with a real cost — the propagation you measured at 14–25 s per pass is the reason it is a cache; (2) a supported cleanup path is the smaller change; (3) the Known Limitations line is free and should not wait for either. I have no standing to commit the project to any of them, and I am not claiming your lease design is the one that should land — but the mechanism you describe for exact revocation (rewriting the DACL minus exactly the grant's explicit entries and clearing the label in the same call) is the shape the current code would need, because What I did ship, since it is the part I can verify. I maintain It deliberately ships no removal command, and that is the same judgement your report argues for: the packaged npm: |
Uh oh!
There was an error while loading. Please reload this page.
Once DSH has written to a folder in
workspace-writemode, three edits stay on its root forever: the capability ACE,Everyone:(CI)(DENY)(DC), andMandatory Label\Low Mandatory Level:(OI)(CI)(NW). They survive the session and DSH exiting. The README describes this as intentional: the grant is a reuse cache and is never revoked.Why this is serious
Most of us don't use only one tool on a project. DSH edits it, then Codex, Claude Code, an IDE or a plain terminal works on the same folder. The label is inherited by every file in the tree. So after one DSH session, whichever tool starts something from that project gets a Low-integrity process or a refusal, and nothing points at DSH as the cause:
0x80000003at startup, with no output and no log.Zone.Identifierexists..bat/.cmd/.exein the project shows "publisher could not be verified" every time.Users end up chasing Electron, antivirus or zone problems for hours. The only recovery today is editing ACLs by hand, and
icaclscannot remove these entries (error 1332, as the README notes).Between 0.2.0-rc.1 and rc.2,
sandbox-windows-acl(acl.ts,grant.ts) andsandbox-localdid not change. The reworked diagnose skill reportsLOW_LABELbut does not remove it.What we would ask for
An approach that works
We implemented the following against the current
sandbox-windows-acl/sandbox-localcode and tested it on real ACLs:<pid>, under a directory keyed by the workspace SID) for as long as it runs. When a workspace has had no live lease for ~30 s, the seam revokes the ACE, the deny and the label. Long commands and background jobs keep their access until they exit. Leases left by a crashed runner name a dead pid and are discarded. The next confined command grants again, and it checks the root first, so a grant removed from outside is repaired.node_modulesincluded) one propagation takes 14–25 s, which should not sit on the Harness event loop.SetEntriesInAclWwithREVOKE_ACCESSnever removes the deny, and removing a whole trustee would also remove the user's own entries. Instead, copy the DACL minus exactly the explicit entries the grant wrote, and clear the label in the sameSetNamedSecurityInfoWcall. While another capability grant is still on the folder, keep the deny and the label. The user's own entries (including their ownEveryoneentries) are left untouched.The cost is one re-propagation per idle period on large trees. That is far better than a project whose own programs stop working for every other tool.
This has now been reported in several threads over a week without a maintainer response. Could someone working on the Windows sandbox take a look?
中文
DSH 只要以
workspace-write写过一个文件夹,它的根目录上就会永久留下三项改动:能力 SID 授权、Everyone:(CI)(DENY)(DC)拒绝项,以及 Low 完整性标签(OI)(CI)(NW)。会话结束、DSH 退出后依然存在。README 写明这是有意为之:授权作为复用缓存,从不撤销。为什么严重
很多人写代码不只用一个工具:同一个项目,DSH 改完,再交给 Codex、Claude Code、IDE 或普通终端。这个标签会被树里每个文件继承。于是 DSH 用过一次之后,不管哪个工具从这个项目里启动东西,得到的都是低完整性进程或者被拒绝,而且没有任何提示指向 DSH:
0x80000003退出,没有输出也没有日志Zone.Identifier.bat/.cmd/.exe每次都弹「无法验证发布者」用户往往要花几个小时去查 Electron、杀毒软件或 Internet 区域。目前唯一的恢复办法是手工改 ACL,而
icacls删不掉这些条目(README 也写了,错误 1332)。0.2.0-rc.1 到 rc.2 之间,
sandbox-windows-acl(acl.ts、grant.ts)和sandbox-local没有任何改动;新的诊断技能会报告LOW_LABEL,但不会去掉它。希望官方做的
一个可行的做法
我们基于现有的
sandbox-windows-acl/sandbox-local代码实现了下面这套,并在真实 ACL 上测过:<pid>,放在按工作区 SID 命名的目录里)。工作区约 30 秒没有活的租约,就撤掉授权、拒绝项和标签。长命令和后台任务在退出前一直保有权限;崩溃留下的租约对应的是已不存在的 pid,会被丢弃。下一条受限命令会先检查根目录再重新授予,所以被外部撤掉的授权也能补回来。node_modules)传播一次要 14–25 秒,不该压在 Harness 的事件循环上。SetEntriesInAclW的REVOKE_ACCESS删不掉 deny,按整个 trustee 删又会带走用户自己的条目。改为复制 DACL,只去掉授权当初写下的那几条显式条目,并在同一次SetNamedSecurityInfoW调用里清掉标签。文件夹上还有其他能力授权时,保留拒绝项和标签。用户自己的条目(包括他们自己的 Everyone 条目)原样保留。代价是大仓库每个空闲周期后要重新传播一次。对每一个别的工具来说,这都远好过项目里自己的程序起不来。
这个问题已经在好几个帖子里报告了一周,一直没有维护者回应。能否请负责 Windows 沙箱方向的同学看一下?
All reactions