feat(sandbox): Windows ACL write-restriction sandbox (restricted-token runner)

Confine Windows command execution through a WRITE_RESTRICTED token whose restricting SIDs carry an orphan-SID write allowlist, ported from https://github.com/huoyaoyuan/windows-acl-restrict-poc (@ 10e4dfb). Every Win32 call is checked and fails closed - the POC silently ran children with the FULL token when CreateRestrictedToken failed.

- @deepseek-ai/dsh-sandbox-windows-acl: koffi primitives verified against the MinGW Windows headers (verify/abi-probe.cpp) plus the confinement runner ([node, runner, --workspace, --temp, --mode, --, argv...]: kill-on-close job, stdio passthrough, exit-code mirroring, windows-acl-run: failure signature, grant revocation). read-only = strict zero grants (NUL device not writable; documented). Windows-only execution: exempted from the Linux coverage lane (windowsOnlyCoverageExclusions).
- @deepseek-ai/dsh-sandbox-local: PLATFORM_CHAINS.win32 filled with the windows-acl runner (full enforcement, ACL denial dialect, runner-failure rules).
- @deepseek-ai/dsh-pwsh-sandbox: sandbox-consuming pwsh executor (call-for-call mirror of dsh-bash-sandbox) over a new argv-level seam in dsh-pwsh-local; per-file coverage complete via the fake-provider spec.
- bundle/base: the Windows platform layer mounts the confined pwsh roster - sandbox/policy/fs-sandbox/permission/approval re-enabled, the POSIX bash stack stays disabled.

Co-authored-by: Huo Yaoyuan <huoyaoyuan@hotmail.com>
This commit is contained in:
Huanqi Cao
2026-08-08 01:24:33 +08:00
parent 4c2d20dbf7
commit f64ba40f43
38 changed files with 3230 additions and 94 deletions

49
pnpm-lock.yaml generated
View File

@@ -753,6 +753,36 @@ importers:
specifier: ^4.0.0-rc.7
version: link:../../../vendor/cordis
packages/bash/pwsh-sandbox:
devDependencies:
'@deepseek-ai/dsh-bash':
specifier: workspace:^
version: link:../bash
'@deepseek-ai/dsh-invariants':
specifier: workspace:^
version: link:../../support/invariants
'@deepseek-ai/dsh-pwsh-local':
specifier: workspace:^
version: link:../pwsh-local
'@deepseek-ai/dsh-sandbox':
specifier: workspace:^
version: link:../../sandbox/sandbox
'@deepseek-ai/dsh-sandbox-local':
specifier: workspace:^
version: link:../../sandbox/sandbox-local
'@deepseek-ai/dsh-sandbox-policy':
specifier: workspace:^
version: link:../../sandbox/sandbox-policy
'@deepseek-ai/dsh-sandbox-windows-acl':
specifier: workspace:^
version: link:../../sandbox/sandbox-windows-acl
'@deepseek-ai/dsh-subprocess-local':
specifier: workspace:^
version: link:../../subprocess/subprocess-local
cordis:
specifier: ^4.0.0-rc.7
version: link:../../../vendor/cordis
packages/bash/tool-bash:
dependencies:
schemastery:
@@ -4457,6 +4487,9 @@ importers:
packages/sandbox/sandbox-local:
dependencies:
'@deepseek-ai/dsh-sandbox-windows-acl':
specifier: workspace:^
version: link:../sandbox-windows-acl
node-addon-landlock-run:
specifier: 0.0.0-test.0
version: 0.0.0-test.0
@@ -4502,6 +4535,22 @@ importers:
specifier: ^4.0.0-rc.7
version: link:../../../vendor/cordis
packages/sandbox/sandbox-windows-acl:
dependencies:
koffi:
specifier: ^3.1.0
version: 3.1.1
devDependencies:
'@deepseek-ai/dsh-invariants':
specifier: workspace:^
version: link:../../support/invariants
'@deepseek-ai/dsh-sandbox-local':
specifier: workspace:^
version: link:../sandbox-local
cordis:
specifier: ^4.0.0-rc.7
version: link:../../../vendor/cordis
packages/sdk/create-sdk:
dependencies:
'@deepseek-ai/dsh-helper':