DSH | @topolyte/windows-acl | 非阻塞 Windows ACL 沙箱授权,消除大工作区首次命令冻结 #3430
Ranecc
started this conversation in
Show Your Plugins!
Replies: 1 comment
|
我是插件库,我感觉你的想法很好,我想收录,可以提ISSUE。 具体提的方法如下。 我也帮你置顶帖子,省得被埋没。 被收录的插件审核前送STAR |
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 | @topolyte/windows-acl | 非阻塞 Windows ACL 沙箱授权,消除大工作区首次命令冻结
背景:为什么做这个插件
官方 windows-acl 后端在大工作区首次授权时会整树同步传播 ACE(见
packages/sandbox/sandbox-windows-acl/src/acl.ts的注释 "eager inheritance; minutes on large workspaces")。官方已有hasExactGrant精确匹配跳过,但这只让第二次 provision 变成 O(1);第一次仍然阻塞。官方不开 issue、不接受 PR,因此把修复做成独立插件发布,任何官方 harness 用户都能直接安装使用。实测 benchmark(劫持官方 grant.ts 源码测量)
同一目录从首次 2,773.7ms → 二次 1.2ms(约 2,300 倍差距),正是用户可感知的冻结;skip 与树大小无关(4,332 与 182,053 文件都是 1.2ms),因为
hasExactGrant只读目录自身 DACL 头。实现要点
grant-cli子进程承载整树遍历,绝不阻塞事件循环(stdio: 'ignore'+ 监听exit,无僵尸进程)。kickOffWorkspaceGrant用workspaceGrantInflightMap 合并并发请求(单线程 tick 内has→set原子),且官方acl.ts已有withPathLock(LockFileEx per-path 锁)兜底多进程场景。confine()保持同步契约,未授权时只 kick-off 不 await,fail-closed。prewarm配置可在启动时预热已知工作区,缩短首条命令前的 fail-closed 窗口。All reactions