Windows sandbox (dsh-sandbox-windows-acl): WRITE_RESTRICTED token breaks Schannel TLS for native HTTPS clients (curl / git / Invoke-WebRequest) #2120
JimmyReload
started this conversation in
General
Replies: 0 comments
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.
Summary
On Windows, every command run under the sandbox (
read-only/workspace-writemodes) fails to perform TLS with any Schannel-based client: curl, git (default sslBackend), Invoke-WebRequest, and any .NETHttpClientall fail atAcquireCredentialsHandlewithSEC_E_NO_CREDENTIALS (0x8009030E)- before any handshake. DNS resolves and TCP connects fine; the failure is purely in Schannel credential acquisition.OpenSSL-based clients (node, python, git with
http.sslBackend=openssl) work normally inside the sandbox.Environment
@deepseek-ai/dsh0.1.0-rc.6,@deepseek-ai/dsh-sandbox-windows-acl0.0.1-rc.1 (latest on npm)Repro
Inside any sandboxed shell (e.g. the
pwshtool, workspace-write mode):Same command run with the normal user token (no sandbox) succeeds (HTTP 200). TCP connectivity inside the sandbox is fine (raw socket to port 443 connects;
Test-NetConnectionsucceeds).Root cause analysis
The Windows runner wraps commands in a restricted token created via
CreateRestrictedTokenwith:DISABLE_MAX_PRIVILEGE | LUA_TOKEN | WRITE_RESTRICTEDI reproduced the failure outside the sandbox by creating the same restricted token in isolation (same machine, same user, same
curl.exe), then exhaustively varied parameters:WRITE_RESTRICTED(flags=5 or 0)Conclusion: the
WRITE_RESTRICTEDflag is both required for the restricted process to start and the cause of the Schannel failure. No combination of restricting SIDs fixes it, andWRITE_RESTRICTEDcannot be removed without breaking process startup. (Adding SYSTEM to the restrict list cannot help because the write access check requires the SID to be present in the token's primary groups too.)Why this is a bug (not intended behavior)
The package README explicitly states the ACL scheme is about file writes: "writes are restricted; reads, network, and process visibility are NOT". Breaking TLS for every native HTTPS client contradicts that documented contract and is not mentioned anywhere in the READMEs or design notes. This effectively makes
curl/Invoke-WebRequest/.NET HttpClientunusable in the default sandbox on Windows.Suggested directions
AcquireCredentialsHandle, and whether a restricted-SID or\Device\CNG-related grant can satisfy it without weakening the write boundary.WRITE_RESTRICTED(or a config to relax token restriction for commands that need native TLS).Workarounds discovered
git config --global http.sslBackend openssl(or-c http.sslBackend=openssl)npm_config_cache)All reactions