@bo-agent/sandbox-windows-acl 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/lib/.tsbuildinfo +1 -0
  2. package/lib/acl.d.ts +83 -0
  3. package/lib/acl.d.ts.map +1 -0
  4. package/lib/acl.js +255 -0
  5. package/lib/acl.js.map +1 -0
  6. package/lib/errors.d.ts +15 -0
  7. package/lib/errors.d.ts.map +1 -0
  8. package/lib/errors.js +20 -0
  9. package/lib/errors.js.map +1 -0
  10. package/lib/ffi.d.ts +252 -0
  11. package/lib/ffi.d.ts.map +1 -0
  12. package/lib/ffi.js +382 -0
  13. package/lib/ffi.js.map +1 -0
  14. package/lib/grant.d.ts +60 -0
  15. package/lib/grant.d.ts.map +1 -0
  16. package/lib/grant.js +102 -0
  17. package/lib/grant.js.map +1 -0
  18. package/lib/index.d.ts +168 -0
  19. package/lib/index.d.ts.map +1 -0
  20. package/lib/index.js +349 -0
  21. package/lib/index.js.map +1 -0
  22. package/lib/invariant.d.ts +15 -0
  23. package/lib/invariant.d.ts.map +1 -0
  24. package/lib/invariant.js +17 -0
  25. package/lib/invariant.js.map +1 -0
  26. package/lib/path-boundary.d.ts +20 -0
  27. package/lib/path-boundary.d.ts.map +1 -0
  28. package/lib/path-boundary.js +37 -0
  29. package/lib/path-boundary.js.map +1 -0
  30. package/lib/runner.d.ts +47 -0
  31. package/lib/runner.d.ts.map +1 -0
  32. package/lib/runner.js +222 -0
  33. package/lib/runner.js.map +1 -0
  34. package/lib/spawn.d.ts +103 -0
  35. package/lib/spawn.d.ts.map +1 -0
  36. package/lib/spawn.js +307 -0
  37. package/lib/spawn.js.map +1 -0
  38. package/lib/token.d.ts +91 -0
  39. package/lib/token.d.ts.map +1 -0
  40. package/lib/token.js +200 -0
  41. package/lib/token.js.map +1 -0
  42. package/lib/win32-abi.d.ts +178 -0
  43. package/lib/win32-abi.d.ts.map +1 -0
  44. package/lib/win32-abi.js +230 -0
  45. package/lib/win32-abi.js.map +1 -0
  46. package/lib/workspace-sid.d.ts +41 -0
  47. package/lib/workspace-sid.d.ts.map +1 -0
  48. package/lib/workspace-sid.js +52 -0
  49. package/lib/workspace-sid.js.map +1 -0
  50. package/package.json +33 -0
package/lib/ffi.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ffi.js","sourceRoot":"","sources":["../src/ffi.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AAOrC;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,KAAmC;IAC3D,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAK,KAAgB,KAAK,EAAE,CAAA;AAC1E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,MAAoC;IAClE,IAAI,SAAS,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAA;IAClC,OAAQ,MAAiB,KAAK,mBAAmB,IAAK,MAAiB,KAAK,CAAC,EAAE,CAAA;AACjF,CAAC;AAoGD,MAAM,KAAK,GAAQ,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;AACxC,MAAM,MAAM,GAAQ,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;AAExC,6FAA6F;AAC7F,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,cAAc,EAAE;IACvD,EAAE,EAAE,QAAQ;IACZ,UAAU,EAAE,OAAO;IACnB,SAAS,EAAE,OAAO;IAClB,OAAO,EAAE,OAAO;IAChB,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,QAAQ;IACb,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,QAAQ;IACjB,aAAa,EAAE,QAAQ;IACvB,aAAa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,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;IACnD,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,MAAM,CAAC,CAAA;IAC1D,IAAI,MAAM,KAAK,CAAC;QAAE,cAAc,CAAC,GAAG,EAAE,cAAc,CAAC,CAAA;IACrD,IAAI,MAAM,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,UAAU,CAAC,cAAc,EAAE,GAAG,CAAC,yBAAyB,EAAE,YAAY,MAAM,qBAAqB,MAAM,CAAC,MAAM,GAAG,CAAC,mCAAmC,CAAC,CAAA;IAClK,CAAC;IACD,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;AAC3D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,GAAkB,EAAE,IAAY,EAAE,MAAe;IAC9E,MAAM,SAAS,GAAG,GAAG,CAAC,YAAY,EAAE,CAAA;IACpC,MAAM,IAAI,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,IAAI,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAA;AAC5E,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,GAAkB,EAAE,IAAY,EAAE,SAAiB,EAAE,MAAe;IAC7F,MAAM,IAAI,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,IAAI,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAA;AAC5E,CAAC"}
package/lib/grant.d.ts ADDED
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Server-side write-grant materialization. The sandbox seam holds one
3
+ * standing workspace grant per workspace and one revocable temp grant per
4
+ * live session/workspace pair. Workspace identities survive by deterministic
5
+ * derivation and their standing ACE; temp identities derive from random
6
+ * private paths and are deliberately new after a restart.
7
+ *
8
+ * Fail-closed: `add` throws on any grant failure and the caller disposes the
9
+ * instance (revoking every path granted so far); `dispose` revokes every
10
+ * standing grant and reports every cleanup failure.
11
+ * @module @bo-agent/sandbox-windows-acl/grant
12
+ */
13
+ import type { Win32Bindings } from './ffi.ts';
14
+ /**
15
+ * One write SID's provider-lifetime grant materialization: the parsed SID
16
+ * pointer plus every directory whose DACL currently carries its ACE.
17
+ * Workspace paths are added STANDING (their ACEs are the cross-session reuse
18
+ * cache and outlive the grant — dispose() skips revoking them, or the next
19
+ * provision would re-propagate the whole tree); temp paths are revocable
20
+ * (dispose() revokes them — an inheritable ACE must not outlive its
21
+ * session's temp directory). Create with {@link AclWriteGrant.create};
22
+ * dispose revokes the revocable paths and frees the SID.
23
+ */
24
+ export declare class AclWriteGrant {
25
+ /** The write SID in SDDL string form. */
26
+ readonly writeSid: string;
27
+ private readonly api;
28
+ private readonly sidPtr;
29
+ private readonly revocablePaths;
30
+ private readonly standingPaths;
31
+ private constructor();
32
+ /**
33
+ * Parse the SID string and open the binding table (lazily, once per
34
+ * server). Fail-closed: any failure throws — nothing is granted yet.
35
+ * @param writeSid - the workspace (`S-1-4-x-y`) or temp (`S-1-4-x-y-1`) capability SID string.
36
+ * @param api - optional already-resolved bindings (tests).
37
+ * @returns the ready grant (no ACEs yet).
38
+ */
39
+ static create(writeSid: string, api?: Win32Bindings): AclWriteGrant;
40
+ /**
41
+ * Grant the write ACE on one directory (idempotent: an already-standing
42
+ * exact ACE skips the eager full-tree re-propagation — see
43
+ * {@link grantWrite}) and record the path for {@link dispose} unless it is
44
+ * standing. The path is recorded BEFORE the grant: a post-apply throw (a
45
+ * LocalFree failure after SetNamedSecurityInfoW succeeded) must still
46
+ * revoke it, and revoking an ungranted path is a no-op merge. Callers
47
+ * treat a throw as a failed materialization and dispose the instance to
48
+ * revoke the paths granted so far.
49
+ * @param path - the directory whose DACL gains the grant.
50
+ * @param standing - the ACE outlives this grant (the workspace reuse
51
+ * cache; dispose() skips revoking it). Default false (revoked on
52
+ * dispose — the temp-directory lifecycle).
53
+ */
54
+ add(path: string, standing?: boolean): void;
55
+ /** Every directory currently carrying the grant, in grant order. */
56
+ get paths(): readonly string[];
57
+ /** Revoke every revocable grant (standing ACEs stay) and free the SID; reports every cleanup failure. */
58
+ dispose(): void;
59
+ }
60
+ //# sourceMappingURL=grant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grant.d.ts","sourceRoot":"","sources":["../src/grant.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EAAa,aAAa,EAAE,MAAM,UAAU,CAAA;AAExD;;;;;;;;;GASG;AACH,qBAAa,aAAa;IACxB,yCAAyC;IACzC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;IAClC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAe;IAC9C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAe;IAE7C,OAAO;IAMP;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,aAAa,GAAG,aAAa;IAWnE;;;;;;;;;;;;;OAaG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,UAAQ,GAAG,IAAI;IAKzC,oEAAoE;IACpE,IAAI,KAAK,IAAI,SAAS,MAAM,EAAE,CAE7B;IAED,yGAAyG;IACzG,OAAO,IAAI,IAAI;CAmBhB"}
package/lib/grant.js ADDED
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Server-side write-grant materialization. The sandbox seam holds one
3
+ * standing workspace grant per workspace and one revocable temp grant per
4
+ * live session/workspace pair. Workspace identities survive by deterministic
5
+ * derivation and their standing ACE; temp identities derive from random
6
+ * private paths and are deliberately new after a restart.
7
+ *
8
+ * Fail-closed: `add` throws on any grant failure and the caller disposes the
9
+ * instance (revoking every path granted so far); `dispose` revokes every
10
+ * standing grant and reports every cleanup failure.
11
+ * @module @bo-agent/sandbox-windows-acl/grant
12
+ */
13
+ import { grantWrite, revokeWrite } from "./acl.js";
14
+ import { allocPtrSlot, decodePtr, isNullPtr, throwLastError, win32Sync } from "./ffi.js";
15
+ /**
16
+ * One write SID's provider-lifetime grant materialization: the parsed SID
17
+ * pointer plus every directory whose DACL currently carries its ACE.
18
+ * Workspace paths are added STANDING (their ACEs are the cross-session reuse
19
+ * cache and outlive the grant — dispose() skips revoking them, or the next
20
+ * provision would re-propagate the whole tree); temp paths are revocable
21
+ * (dispose() revokes them — an inheritable ACE must not outlive its
22
+ * session's temp directory). Create with {@link AclWriteGrant.create};
23
+ * dispose revokes the revocable paths and frees the SID.
24
+ */
25
+ export class AclWriteGrant {
26
+ /** The write SID in SDDL string form. */
27
+ writeSid;
28
+ api;
29
+ sidPtr;
30
+ revocablePaths = [];
31
+ standingPaths = [];
32
+ constructor(api, sidPtr, writeSid) {
33
+ this.api = api;
34
+ this.sidPtr = sidPtr;
35
+ this.writeSid = writeSid;
36
+ }
37
+ /**
38
+ * Parse the SID string and open the binding table (lazily, once per
39
+ * server). Fail-closed: any failure throws — nothing is granted yet.
40
+ * @param writeSid - the workspace (`S-1-4-x-y`) or temp (`S-1-4-x-y-1`) capability SID string.
41
+ * @param api - optional already-resolved bindings (tests).
42
+ * @returns the ready grant (no ACEs yet).
43
+ */
44
+ static create(writeSid, api) {
45
+ const bindings = api ?? win32Sync();
46
+ const sidSlot = allocPtrSlot();
47
+ if (bindings.convertStringSidToSidW(writeSid, sidSlot) === 0) {
48
+ throwLastError(bindings, 'ConvertStringSidToSidW', writeSid);
49
+ }
50
+ const sidPtr = decodePtr(sidSlot);
51
+ if (sidPtr === null)
52
+ throwLastError(bindings, 'ConvertStringSidToSidW', `null SID for ${writeSid}`);
53
+ return new AclWriteGrant(bindings, sidPtr, writeSid);
54
+ }
55
+ /**
56
+ * Grant the write ACE on one directory (idempotent: an already-standing
57
+ * exact ACE skips the eager full-tree re-propagation — see
58
+ * {@link grantWrite}) and record the path for {@link dispose} unless it is
59
+ * standing. The path is recorded BEFORE the grant: a post-apply throw (a
60
+ * LocalFree failure after SetNamedSecurityInfoW succeeded) must still
61
+ * revoke it, and revoking an ungranted path is a no-op merge. Callers
62
+ * treat a throw as a failed materialization and dispose the instance to
63
+ * revoke the paths granted so far.
64
+ * @param path - the directory whose DACL gains the grant.
65
+ * @param standing - the ACE outlives this grant (the workspace reuse
66
+ * cache; dispose() skips revoking it). Default false (revoked on
67
+ * dispose — the temp-directory lifecycle).
68
+ */
69
+ add(path, standing = false) {
70
+ ;
71
+ (standing ? this.standingPaths : this.revocablePaths).push(path);
72
+ grantWrite(this.api, path, this.sidPtr);
73
+ }
74
+ /** Every directory currently carrying the grant, in grant order. */
75
+ get paths() {
76
+ return [...this.standingPaths, ...this.revocablePaths];
77
+ }
78
+ /** Revoke every revocable grant (standing ACEs stay) and free the SID; reports every cleanup failure. */
79
+ dispose() {
80
+ const failures = [];
81
+ for (const path of this.revocablePaths) {
82
+ try {
83
+ revokeWrite(this.api, path, this.sidPtr);
84
+ }
85
+ catch (error) {
86
+ failures.push(error);
87
+ }
88
+ }
89
+ try {
90
+ const freed = this.api.localFree(this.sidPtr);
91
+ if (!isNullPtr(freed))
92
+ throwLastError(this.api, 'LocalFree', 'write SID');
93
+ }
94
+ catch (error) {
95
+ failures.push(error);
96
+ }
97
+ if (failures.length > 0) {
98
+ throw new AggregateError(failures, `AclWriteGrant dispose completed with ${failures.length} cleanup failure(s)`);
99
+ }
100
+ }
101
+ }
102
+ //# sourceMappingURL=grant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grant.js","sourceRoot":"","sources":["../src/grant.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAA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* sandbox seam. Mirrors the mechanism of github.com/huoyaoyuan/
4
+ * windows-acl-restrict-poc @ 10e4dfb (the fixed revision): a WRITE_RESTRICTED
5
+ * token whose restricting SIDs include distinct workspace and temp write
6
+ * SIDs that this sandbox adds to their owning directories' DACLs — the
7
+ * intersection check then allows writes exactly where either capability has
8
+ * a Write ACE, and nowhere else those SIDs are concerned (the check ALSO
9
+ * inherits the ambient write ACEs of the other restricting SIDs — the
10
+ * keep-alive group logon SID + Everyone; Authenticated Users, INTERACTIVE,
11
+ * and LOCAL are absent from both lists — see the seam's dual-list contract
12
+ * in `packages/sandbox/sandbox-local` and the package README's Modes section
13
+ * for the complete boundary). The write SID is the per-WORKSPACE identity
14
+ * ({@link workspaceWriteSid}): deterministic from the canonical workspace
15
+ * path, so the workspace-root ACE materializes once per workspace per
16
+ * machine and every later provision hits the exact-ACE skip — the
17
+ * grant-reuse story the per-session random SID paid a full tree propagation
18
+ * per session for. Each private temp directory instead receives its own SID,
19
+ * so sibling sessions sharing a workspace cannot enter one another's temp
20
+ * trees. Unlike the POC, every API failure throws with the API
21
+ * name and exact Win32 code; a child is NEVER spawned unrestricted.
22
+ *
23
+ * Known boundaries (inherent to restricted tokens, not this port):
24
+ * - writes are restricted; reads, network, and process visibility are NOT
25
+ * (WRITE_RESTRICTED intersects only write accesses);
26
+ * - console isolation is unavailable — children share the host console
27
+ * (CREATE_NO_WINDOW / CREATE_NEW_CONSOLE children die with
28
+ * STATUS_DLL_INIT_FAILED under the restriction);
29
+ * - the private temp directory and every writable directory must be owned by the
30
+ * caller (owner-implicit WRITE_DAC);
31
+ * - grants are standing ACE mutations on real directories. WORKSPACE grants
32
+ * are deliberately never revoked — the ACE is the cross-session reuse
33
+ * cache (revoking would force the next session to re-propagate the whole
34
+ * tree). TEMP grants are revocable: dispose() removes them so a standing
35
+ * inheritable ACE never outlives its session's temp directory. The
36
+ * ambient temp root is never granted implicitly. With `manageDacls: false`
37
+ * the CALLER owns the DACLs (the sandbox seam's grant reuse):
38
+ * init()/dispose() skip grant/revoke entirely and the caller must not
39
+ * revoke under live children.
40
+ * @module @bo-agent/sandbox-windows-acl
41
+ */
42
+ export { quoteArg } from './spawn.ts';
43
+ export { AclWriteGrant } from './grant.ts';
44
+ export { assertTempRootOutsideWorkspace } from './path-boundary.ts';
45
+ export { tempWriteSid, workspaceWriteSid } from './workspace-sid.ts';
46
+ export { Win32Error } from './errors.ts';
47
+ /** Construction options: the workspace/temp allowlists and their distinct SID identities. */
48
+ export interface AclSandboxOptions {
49
+ /** Directories the confined child may write into (must exist and be caller-owned). */
50
+ writableDirs: readonly string[];
51
+ /**
52
+ * Existing private temp directory to grant. Workspace-write callers must
53
+ * pass it explicitly or pass null to disable temp writes; the ambient temp
54
+ * root is never an implicit grant. Read-only accepts only null/undefined.
55
+ */
56
+ tempDir?: string | null;
57
+ /**
58
+ * The write SID forming the workspace-write allowlist: REQUIRED under
59
+ * workspace-write, ignored (and must be absent) under read-only. Callers
60
+ * derive it from the workspace via {@link workspaceWriteSid} — the identity
61
+ * is per workspace, not per sandbox instance, so the workspace-root ACE
62
+ * outlives every instance and later provisions hit the exact-ACE skip.
63
+ */
64
+ writeSid?: string;
65
+ /**
66
+ * The private temp directory's write SID. Required whenever
67
+ * workspace-write grants a temp directory, absent otherwise. It must be
68
+ * distinct from {@link writeSid}, so sibling sessions sharing a workspace
69
+ * cannot use the standing workspace capability in one another's temp tree.
70
+ */
71
+ tempWriteSid?: string;
72
+ /**
73
+ * The file-effect mode this instance confines under — selects the
74
+ * restricted token's restricting-SID list (I for read-only, J for
75
+ * workspace-write) and MUST match the grant shape: read-only pairs with
76
+ * zero grants. The runner validates the argv-borne mode string at its
77
+ * boundary; this typed seam trusts the union.
78
+ */
79
+ mode: 'read-only' | 'workspace-write';
80
+ /**
81
+ * Whether this instance owns its DACL grants (default true). False means
82
+ * the CALLER has already materialized the ACEs (the sandbox seam's
83
+ * workspace/temp capability lifecycle): init()/dispose() skip grant/revoke entirely —
84
+ * the caller holds the grants for its own lifetime and revokes them.
85
+ */
86
+ manageDacls?: boolean;
87
+ }
88
+ /** Per-spawn options: the program, its argv/cwd, and the stdio shape. */
89
+ export interface AclSandboxSpawnOptions {
90
+ /** Program to run (resolved via PATH search when unqualified, like CreateProcess). */
91
+ command: string;
92
+ /** Arguments, quoted per CommandLineToArgvW rules. */
93
+ args?: readonly string[];
94
+ /** Working directory; defaults to the caller's cwd. */
95
+ cwd?: string;
96
+ /**
97
+ * 'pipe' (default): capture stdout/stderr via anonymous pipes.
98
+ * 'inherit': the child inherits the caller's stdio directly (runner usage —
99
+ * bytes flow straight through), always wrapped in a kill-on-close job so the
100
+ * child dies with the caller; stdout/stderr in the result are empty.
101
+ */
102
+ stdio?: 'pipe' | 'inherit';
103
+ }
104
+ /** A settled confined child: captured stdio and the exit code. */
105
+ export interface AclSandboxChildResult {
106
+ stdout: Buffer;
107
+ stderr: Buffer;
108
+ exitCode: number;
109
+ }
110
+ /** A running confined child: its pid and a settlement promise. */
111
+ export interface AclSandboxChild {
112
+ /** Child process id. */
113
+ pid: number;
114
+ /** Resolve stdout/stderr and the exit code once the child exits. */
115
+ wait(): Promise<AclSandboxChildResult>;
116
+ }
117
+ /**
118
+ * One write-restricted sandbox instance: token + write-SID grants + spawn.
119
+ * `init()` is fail-closed — any Win32 failure revokes the revocable (temp)
120
+ * grants and throws; `dispose()` revokes the temp grants, leaves the
121
+ * standing workspace ACEs in place (the cross-instance reuse cache), frees
122
+ * every allocation, and reports every cleanup failure. With
123
+ * `manageDacls: false` the caller owns the grants (the sandbox seam's grant
124
+ * reuse): init() applies none and dispose() revokes none.
125
+ */
126
+ export declare class AclSandbox {
127
+ /** Absolute writable directories (constructor-validated). */
128
+ readonly writableDirs: string[];
129
+ /** The workspace SID string whose ACEs form the workspace allowlist. */
130
+ readonly writeSid: string | undefined;
131
+ /** The private temp directory's write SID (workspace-write with temp only). */
132
+ readonly tempWriteSid: string | undefined;
133
+ /** The file-effect mode — the restricted token's restricting-SID list selection. */
134
+ readonly mode: 'read-only' | 'workspace-write';
135
+ private readonly tempDirOption;
136
+ private readonly manageDacls;
137
+ private tempDirResolved;
138
+ private api;
139
+ private token;
140
+ private writeSidPtr;
141
+ private tempWriteSidPtr;
142
+ /** The well-known/logon SID allocations init() makes; freed by dispose() alongside the write SIDs. */
143
+ private sidAllocations;
144
+ private grantedPaths;
145
+ constructor(options: AclSandboxOptions);
146
+ /** Resolved temp directory (available after init; null when temp grants are disabled). */
147
+ get tempDir(): string | null | undefined;
148
+ /** Create the restricted token and apply the capability-SID grants. Idempotent-unsafe: once per instance. */
149
+ init(): Promise<void>;
150
+ /**
151
+ * Spawn a process under the restricted token. Fails closed: throws on every
152
+ * Win32 failure; the child is never created unrestricted. With
153
+ * `stdio: 'inherit'` the child shares the caller's stdio directly and is
154
+ * placed in a kill-on-close job (dies with the caller). Call dispose() only
155
+ * after all children have exited — revoking grants under a live child
156
+ * removes its remaining write allowance.
157
+ * @param options - the program, argv/cwd, and stdio shape.
158
+ * @returns the running child.
159
+ */
160
+ spawn(options: AclSandboxSpawnOptions): AclSandboxChild;
161
+ /**
162
+ * Revoke the revocable (temp) grants, free the SID, close the token; the
163
+ * standing workspace ACEs stay (the reuse cache). Reports every cleanup
164
+ * failure.
165
+ */
166
+ dispose(): void;
167
+ }
168
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAcH,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,C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