fix(sandbox): harden the per-session record and the ACL runner failure paths (review round v6)

Durable record: bound to the owning session id and validated at the fold (orphan-SID shape, temp path inside the host temp root) — a fork's copied parent record no longer provisions the child, and a tampered record fails loud. Private temp dir: random unguessable name persisted in the record, created exclusively (pre-existing entries and reparse points fail EEXIST). Persistence: a fresh provision kicks an immediate flush (no write-behind debounce), narrowing the crash window to the flush latency — documented as the one self-healing gap. Runner-failure rules: exit-gated on 127 so a confined command that prints the signature on a non-127 exit is never misclassified. Spawn: AssignProcessToJobObject failure terminates the suspended child (no hanging orphans). SandboxExecutionPolicy.sessionId is the branded SessionId. Boundary docs: qualifying clause on the absolutist sentences, NULL-DACL Known Limitation, 'full' scoped to the supported NTFS surface, CLM gate comment.
This commit is contained in:
Huanqi Cao
2026-08-08 23:23:38 +08:00
parent 441927c526
commit 6478da61e3
27 changed files with 472 additions and 278 deletions

View File

@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/core-data-structures/sandbox.md
sandbox.md: a9a1fec080e1cf86ea63e02e062b775cd6d4d0da
sandbox.zh.md: 99505265a9c440a14cc0cfc5473823ca5514984c
sandbox.md: 75e9a0a9b1eb85a5c097f2c583a1fdf94da62305
sandbox.zh.md: df2dae84f43d5e64bb11418012bdcbd196f028f2

View File

@@ -54,12 +54,12 @@ interface SandboxExecutionPolicy {
/** Absolute root directory `workspace-write` may write under. */
workspaceRoot: string
/**
* Opaque identity of the calling session (the `dsh-session` SessionId in
* string form). Backends key per-session state off it (e.g. the windows-acl
* Opaque identity of the calling session (the branded `dsh-session`
* SessionId). Backends key per-session state off it (e.g. the windows-acl
* per-session write grant and private temp subdirectory); absent for
* agentless calls, which fall back to per-call backend state.
*/
sessionId?: string
sessionId?: SessionId
}
```

View File

@@ -54,12 +54,12 @@ interface SandboxExecutionPolicy {
/** Absolute root directory `workspace-write` may write under. */
workspaceRoot: string
/**
* Opaque identity of the calling session (the `dsh-session` SessionId in
* string form). Backends key per-session state off it (e.g. the windows-acl
* Opaque identity of the calling session (the branded `dsh-session`
* SessionId). Backends key per-session state off it (e.g. the windows-acl
* per-session write grant and private temp subdirectory); absent for
* agentless calls, which fall back to per-call backend state.
*/
sessionId?: string
sessionId?: SessionId
}
```