@argszero/cordis-plugin-sandbox-grant-advisor 0.7.1 → 0.8.0

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.
package/README.md CHANGED
@@ -236,8 +236,9 @@ the advisory never names the dead directory.
236
236
 
237
237
  ### 3. A confined child that never started (`native-init`)
238
238
 
239
- Three reports of one exit code: [`#7876`] and [`#8193`] (the packaged desktop
240
- app, measured twice) and [`#7877`] (MSYS2 / Git Bash). All are `0xC0000142`
239
+ Four reports of one exit code: [`#7876`] and [`#8193`] (the packaged desktop
240
+ app) and [`#7877`] (MSYS2 / Git Bash) — and [`#8208`], which found the mechanism
241
+ the console cases share. All are `0xC0000142`
241
242
  `STATUS_DLL_INIT_FAILED` — the Windows
242
243
  loader terminated the process while it was initializing its native images, i.e.
243
244
  **before the program's entry point**. A command that ran and then failed exits
@@ -259,65 +260,101 @@ Two producers have been measured under a confining mode:
259
260
  (`@deepseek-ai/dsh-base/cordis.patch.yml`), so the combination is likely
260
261
  never covered upstream. The **one conversion a model can make itself** is to
261
262
  write the same work as a PowerShell or `cmd` command.
262
- 2. **The packaged desktop app's sandbox runner** ([`#7876`], [`#8193`]).
263
+ 2. **The packaged desktop app's sandbox runner** ([`#8193`], [`#8208`]).
263
264
  `dsh-sandbox-local` launches the runner as `[process.execPath, entry]`, and
264
- in the packaged build `process.execPath` is the Electron executable. Two
265
- measurements of that host exist and — from inside a session — they are
266
- indistinguishable, so the advisory names **both** instead of asserting one:
267
- **(a)** the runner does not start at all — the Electron binary begins as an
268
- *application* unless the child's environment carries `ELECTRON_RUN_AS_NODE=1`,
269
- so nothing on the runner path ran ([`#7876`]); **(b)** the runner *does*
270
- start — the desktop launcher sets exactly that variable — and the command
271
- still dies, because the restricted token is derived from the Electron process
272
- image and the child does not survive being started under it ([`#8193`]). A
273
- reader outside the session separates them (is `ELECTRON_RUN_AS_NODE` set for
274
- that host, and does the ACL runner appear among its processes while the
275
- command runs?); from inside the session they are one finding with one remedy.
276
- The unpacked node host (`node apps/cli/lib/bin.js web`) is unaffected. The
277
- plugin reports whether *this* process is an Electron binary
278
- (`process.versions.electron`) as a measured fact rather than assuming it,
279
- because that is the check the discriminator turns on. **0.6.0 asserted shape
280
- (a) alone** — "so the runner never runs" — and handed the Electron reader a
281
- cause that [`#8193`] measures to be false; the single-cause sentence is gone,
282
- and a test arm keeps it gone.
283
-
284
- **The remedy is the host, and 0.7.1 says so in that order.** [`#8193`] did not
285
- only split the producer — it measured the way out: hosted on the desktop's own
286
- bundled standalone node
265
+ in the packaged build `process.execPath` is the Electron executable. **The
266
+ mechanism is the runner's console, not its token** ([`#8208`]): the confined
267
+ child inherits a console from the runner, and a runner that owns none leaves
268
+ the child to ask for one of its own — which a restricted token may not have.
269
+ The capture is three lines: `conhost.exe` is created *by the restricted child*,
270
+ exits `0xC0000022 STATUS_ACCESS_DENIED`, and the child then dies with
271
+ `0xC0000142`. Two console-less configurations are measured, and they share that
272
+ mechanism: **(a)** the host binary is a GUI-subsystem program, which never owns
273
+ a console — the packaged desktop, where every confined command dies this way
274
+ ([`#8193`]); **(b)** the host binary is a real console-subsystem `node.exe` and
275
+ the runner was still spawned without a console, because `DETACHED_PROCESS` was
276
+ set — `spawnSync(node, [runner, …], { detached: true })` returns `0xC0000142`
277
+ where the identical call without that flag returns `0` ([`#8208`]). Shape (b) is
278
+ the one worth handing over, because it needs no desktop and no particular
279
+ machine. **What is *not* the discriminator is the token**: [`#8208`] compared
280
+ `whoami /groups` and `/priv` from children of a working node host and of the
281
+ failing Electron host and found them identical, and a low-integrity `cmd.exe`
282
+ runs fine on that machine. The plugin reports whether *this* process is an
283
+ Electron binary (`process.versions.electron`) as a measured fact rather than
284
+ assuming it.
285
+
286
+ **`0.7.x` named two shapes and explained them with the wrong mechanism, and
287
+ `0.8.0` withdraws one of the shapes outright.** The withdrawn shape is "the
288
+ runner does not start at all, because `ELECTRON_RUN_AS_NODE=1` is missing": the
289
+ desktop sets that variable on its own host child
290
+ (`apps/desktop/src/host-process.ts` → `desktopNodeEnvironment()`,
291
+ `apps/desktop/src/node-environment.ts:15`), so nothing on the runner path can
292
+ fail to start for want of it — and [`#8208`] measured the variable present in
293
+ *both* hosts, including the one that works. The token story goes with it, for
294
+ the same measurement. A cause the advisory shipped twice earns its sentence
295
+ when it is retracted, and test arms keep both retractions in place.
296
+
297
+ **The remedy is a real node host — with one condition riding on it.** [`#8193`]
298
+ measured the way out: hosted on the desktop's own bundled standalone node
287
299
  (`resources/runtime/primary-runtime/dependencies/node/bin/node.exe`, v24.21.0)
288
300
  the *same* confined `pwsh.exe` / `cmd.exe` spawns succeed (exit 81 / 82), with
289
301
  workspace, temp directory, mode, SIDs, target and runner `sha256` all held
290
- constant. The advisory now leads the Electron branch with that, and demotes
291
- `danger-full-access` to what it actually is — a way to **confirm** the
292
- diagnosis, not a fix, and on this platform one that silently removes the
293
- sandbox from every shell call. The reporter's own reason is the one the plugin
294
- repeats: *"the practical effect is that Windows Desktop users must escalate to
295
- full access for all shell work, which silently removes the sandbox on that
296
- platform"*, and they asked explicitly that this not be "fixed" with
297
- `--disable-sandbox` / `--disable-gpu-sandbox` — those disable Chromium's
298
- renderer sandbox, a different layer from the DSH file policy. The advisory also
299
- warns off the opposite-looking move: unsetting `ELECTRON_RUN_AS_NODE` does not
300
- help, because the desktop's runner **is** that Electron binary and without the
301
- variable it cannot execute `runner.js` at all — the interaction [`#8193`]
302
- records with [`#8174`], where a fix that tombstones the variable in the shared
303
- child environment would take the ACL runner down with it, so the two changes
304
- have to land together.
302
+ constant. [`#8208`] reproduced it (exit `0`, the command's own stdout intact)
303
+ on the same runtime installed for workspace dependencies
304
+ (`%USERPROFILE%\.dsh\dsh-runtimes\dsh-primary-runtime\dependencies\node\bin\node.exe`,
305
+ present once `load_workspace_dependencies` has run) and with `windowsHide` both
306
+ set and unset. **The condition is that the runner must be spawned *with* a
307
+ console** — not with `DETACHED_PROCESS` — because a real host alone is not
308
+ enough when that flag is set ([`#8208`]): the host binary supplies the console
309
+ and the spawn flag is what can take it away again. Where no real host can be
310
+ put in front of the runner, the same effect fits inside it: `AllocConsole`
311
+ before the restricted spawn, with the three standard handles restored
312
+ afterwards, in `dsh-win32-process`'s `createRestrictedProcess` — the funnel
313
+ every restricted child goes through. [`#8208`] measured `cmd /c exit` and
314
+ `pwsh -c "Write-Output …"` both reaching `0` with stdout intact under that
315
+ change, and as a no-op on a runner that already owns a console; it costs a
316
+ `user32` binding and one console host per runner process. `danger-full-access`
317
+ is demoted to what it actually is — a way to **confirm** the diagnosis, not a
318
+ fix, and on this platform one that silently removes the sandbox from every
319
+ shell call. The reporter's own reason is the one the plugin repeats: *"the
320
+ practical effect is that Windows Desktop users must escalate to full access for
321
+ all shell work, which silently removes the sandbox on that platform"*, and they
322
+ asked explicitly that this not be "fixed" with `--disable-sandbox` /
323
+ `--disable-gpu-sandbox` — those disable Chromium's renderer sandbox, a
324
+ different layer from the DSH file policy. The advisory also warns off the
325
+ opposite-looking move: unsetting `ELECTRON_RUN_AS_NODE` does not help, because
326
+ the desktop's runner **is** that Electron binary and dropping the variable
327
+ would take `runner.js` down with it — the interaction [`#8193`] records with
328
+ [`#8174`], where a fix that tombstones the variable in the shared child
329
+ environment would take the ACL runner down with it, so the two changes have to
330
+ land together.
305
331
 
306
332
  **What the flag vocabulary actually is.** The backend's own source records one
307
333
  inherent boundary: *"console isolation is unavailable — children share the host
308
334
  console (`CREATE_NO_WINDOW` / `CREATE_NEW_CONSOLE` children die with
309
335
  `STATUS_DLL_INIT_FAILED` under the restriction)"*
310
- (`packages/sandbox/sandbox-windows-acl/src/index.ts`), echoed at
311
- `packages/subprocess/win32-process/src/process.ts:454`. [`#8193`] refines that
312
- recording instead of repeating it, and the refinement is worth keeping exact:
313
- the restricted-token path spawns with **`CREATE_SUSPENDED` alone**
314
- (`process.ts:537-545`) and the ordinary current-token path with
315
- **`CREATE_SUSPENDED | CREATE_UNICODE_ENVIRONMENT`** (`process.ts:567`, i.e.
316
- `0x404`); `CREATE_NO_WINDOW` (`0x08000000`) is **not a constant anywhere in
317
- that source** — only those two comments name it at all. So the flags in use are
318
- a necessary-but-insufficient ingredient: the same flags that are fatal under an
319
- Electron host succeed under a real-node host, and the host process image is
320
- what turns them fatal.
336
+ (`packages/sandbox/sandbox-windows-acl/README.md:119`), echoed at
337
+ `packages/subprocess/win32-process/src/process.ts:454`. [`#8208`] **explains**
338
+ that recording instead of repeating it, and the explanation is the invariant
339
+ the two shapes share: **in a restricted token a console can be inherited but
340
+ not created.** The creation flags actually passed are three sets and none of
341
+ them is `CREATE_NO_WINDOW` — `0` on the piped path (`process.ts:243`, the path a
342
+ shell call takes), `CREATE_SUSPENDED` on the inherited-job path
343
+ (`process.ts:542`) and `CREATE_SUSPENDED | CREATE_UNICODE_ENVIRONMENT` on the
344
+ ordinary path (`process.ts:567`, i.e. `0x404`); `CREATE_NO_WINDOW`
345
+ (`0x08000000`) is **not a constant anywhere in that source**. Those flags are
346
+ fatal under a console-less runner and harmless under one that owns a console —
347
+ so it is the console, not the flag list, that decides. `0.7.x` wrote the
348
+ two-set version of that list and called the flags "a necessary ingredient ...
349
+ the host process image is what turns it fatal"; both halves were wrong, and
350
+ `0.8.0` replaces them.
351
+
352
+ **One arm was applied, measured, and rejected.** Putting `DETACHED_PROCESS` on
353
+ the *restricted child* removes its console request and does stop the crash —
354
+ but `pwsh` then exits `0` with **zero bytes on stdout and stderr**, while
355
+ `cmd.exe` keeps its output ([`#8208`]). That trades a loud failure for a silent
356
+ one on the interpreter most likely to be used, so the advisory names it as a
357
+ non-remedy instead of offering it; the runner-side remedies keep the output.
321
358
 
322
359
  **Why this family is read from a successful result.** The producer never marks
323
360
  it an error, and that is a fact about upstream rather than a choice here:
@@ -622,6 +659,7 @@ the current runtime cannot distinguish rather than counting it as a pass.
622
659
  [discussion #7638]: https://github.com/deepseek-ai/deepseek-harness/discussions/7638
623
660
  [discussion #7876]: https://github.com/deepseek-ai/deepseek-harness/discussions/7876
624
661
  [discussion #7877]: https://github.com/deepseek-ai/deepseek-harness/discussions/7877
662
+ [discussion #8208]: https://github.com/deepseek-ai/deepseek-harness/discussions/8208
625
663
  [#7750]: https://github.com/deepseek-ai/deepseek-harness/discussions/7750
626
664
  [#7771]: https://github.com/deepseek-ai/deepseek-harness/discussions/7771
627
665
  [#7804]: https://github.com/deepseek-ai/deepseek-harness/discussions/7804
@@ -629,3 +667,4 @@ the current runtime cannot distinguish rather than counting it as a pass.
629
667
  [#7877]: https://github.com/deepseek-ai/deepseek-harness/discussions/7877
630
668
  [#8193]: https://github.com/deepseek-ai/deepseek-harness/discussions/8193
631
669
  [#8174]: https://github.com/deepseek-ai/deepseek-harness/discussions/8174
670
+ [#8208]: https://github.com/deepseek-ai/deepseek-harness/discussions/8208
package/lib/advice.js CHANGED
@@ -58,12 +58,21 @@
58
58
  * is guess which producer this is: the code alone cannot say, and the two
59
59
  * checks it hands over are facts the reader holds (what program they ran;
60
60
  * whether this is the packaged desktop app, which the plugin reports rather
61
- * than assumes). That Electron host is itself **two measurements**, not one —
62
- * a runner that never started at all, and a runner that did start and whose
63
- * child cannot survive the restricted token derived from an Electron process
64
- * image — and the advisory names both instead of asserting the one it shipped
65
- * first, because a session cannot tell them apart and a confidently wrong
66
- * cause is worse than two named ones with one shared remedy.
61
+ * than assumes). That Electron host was shipped as **two measurements**; since
62
+ * 0.8.0 it is **one mechanism, named**: the runner must own a *console* for the
63
+ * confined child to inherit, and when it owns none the child's own console
64
+ * request is denied under the restricted token (`#8208` traced it to
65
+ * `conhost.exe` created by the restricted child, exiting `STATUS_ACCESS_DENIED`).
66
+ * The two measured console-less shapes are a GUI-subsystem host image (the
67
+ * packaged desktop) and a `DETACHED_PROCESS` runner under a real `node.exe`
68
+ * host — the second reproducible on any machine, which is what makes it the
69
+ * check worth handing over. The shape 0.7.x led with, "the runner never started
70
+ * at all", is **withdrawn**: the desktop's own host child is started with
71
+ * `ELECTRON_RUN_AS_NODE=1` (`apps/desktop/src/host-process.ts` ->
72
+ * `desktopNodeEnvironment()`), so nothing on the runner path fails to start for
73
+ * want of that variable. A withdrawn cause earns its sentence because this
74
+ * advisory shipped it twice; a confidently wrong cause is worse than two named
75
+ * ones with one shared remedy.
67
76
  *
68
77
  * Both give a **discriminator, not just a remedy**: applying a fix without
69
78
  * confirming the cause teaches nothing when the fix does not work. For the ACL
@@ -87,7 +96,7 @@ export const ACL_DISCUSSIONS = '#7538 / #7622 / #7646 / #7720 / #7750 / #7735 /
87
96
  /** The upstream thread the persistent-shell advisory is a stopgap for. */
88
97
  export const PTY_DISCUSSIONS = '#7638';
89
98
  /** The upstream threads the native-init-death advisory is a stopgap for. */
90
- export const NATIVE_INIT_DISCUSSIONS = '#7876 / #7877 / #8193';
99
+ export const NATIVE_INIT_DISCUSSIONS = '#7876 / #7877 / #8193 / #8208';
91
100
  /** The documented prerequisite, quoted from the backend's README. */
92
101
  export const PREREQUISITE = 'granted directories must be caller-owned and grant `WRITE_OWNER`';
93
102
  /**
@@ -367,46 +376,76 @@ function nativeInitAdvisory(failure, mode, onElectron, href) {
367
376
  ' continue — do not retry the MSYS2 program.',
368
377
  ' 2. The packaged desktop application\'s sandbox runner. `dsh-sandbox-local` starts the runner as',
369
378
  ' `[process.execPath, runner.js]`, and in the packaged build `process.execPath` is the Electron',
370
- ' executable. Two measurements of that host exist and from inside a session they are',
371
- ' indistinguishable, so both are named here rather than one asserted:',
372
- ' (a) the runner does not start at all: the Electron binary begins as an *application* unless the',
373
- ' child\'s environment carries `ELECTRON_RUN_AS_NODE=1`, so nothing on the runner path ran (#7876);',
374
- ' (b) the runner does start — the desktop launcher sets exactly that variable — and the command still',
375
- ' dies, because the restricted token is derived from the Electron process image and the child does',
376
- ' not survive being started under it (#8193).',
377
- ' A reader outside the session separates them (is `ELECTRON_RUN_AS_NODE` set for that host, and does',
378
- ' the ACL runner appear among its processes while the command runs?); from inside the session they are',
379
- ' one finding with one remedy, so nothing here waits on telling them apart.',
379
+ ' executable. The mechanism behind this one is the runner\'s CONSOLE, not its token: the confined',
380
+ ' child inherits a console from the runner, and a runner that owns none leaves the child to ask for one',
381
+ ' of its own — which a restricted token is not allowed to have. #8208 captured the sequence: `conhost.exe`',
382
+ ' is created BY the restricted child, exits `0xC0000022 STATUS_ACCESS_DENIED`, and the child then dies',
383
+ ' with the code above. Both console-less configurations are measured:',
384
+ ' (a) the host binary is a GUI-subsystem program, which never owns a console — the packaged desktop,',
385
+ ' where every confined command dies this way (#8193);',
386
+ ' (b) the host binary is a real console-subsystem `node.exe` and the runner was still spawned without a',
387
+ ' console, because `DETACHED_PROCESS` was set: `spawnSync(node, [runner, …], { detached: true })`',
388
+ ' returns `0xC0000142` while the same call without that flag returns `0` (#8208). That arm needs no',
389
+ ' desktop and no particular machine, so it is the check worth running here.',
390
+ ' What is NOT the discriminator: the token. #8208 compared `whoami /groups` and `/priv` from children of',
391
+ ' a working node host and of the failing Electron host — identical, down to the group count and session —',
392
+ ' and a low-integrity `cmd.exe` runs fine on that machine, so neither the token nor low integrity alone',
393
+ ' explains this.',
380
394
  ...(onElectron
381
395
  ? [
382
- ' This process IS an Electron binary (`process.versions.electron` is set), so that producer applies here.',
383
- ' The way out is a real node host, not a wider mode: the packaged desktop ships one at',
384
- ' `resources/runtime/primary-runtime/dependencies/node/bin/node.exe`, and the unpacked',
385
- ' `node apps/cli/lib/bin.js web` host works for the same reason — the same confined `pwsh`/`cmd` calls',
386
- ' start there (#8193 measured exit 81/82). The command starts there in either shape, and that — the',
387
- ' host, not the flags — is the discriminator. `danger-full-access` only CONFIRMS the diagnosis: on this',
388
- ' platform it silently removes the sandbox from every shell call. Do not unset `ELECTRON_RUN_AS_NODE`',
389
- ' instead either — the desktop runner IS that Electron binary, so without it `runner.js` cannot',
390
- ' execute at all (#8193 records this interaction with #8174).',
396
+ ' This process IS an Electron binary (`process.versions.electron` is set), so a GUI-subsystem host',
397
+ ' applies here. The way out is a real node host — the packaged desktop ships one at',
398
+ ' `resources/runtime/primary-runtime/dependencies/node/bin/node.exe`, and the same runtime installed',
399
+ ' for workspace dependencies lands at',
400
+ ' `%USERPROFILE%\\.dsh\\dsh-runtimes\\dsh-primary-runtime\\dependencies\\node\\bin\\node.exe` (present',
401
+ ' once `load_workspace_dependencies` has run) — and the unpacked `node apps/cli/lib/bin.js web` host',
402
+ ' works for the same reason: the same confined `pwsh`/`cmd` calls start there (#8193 measured exit',
403
+ ' 81/82; #8208 measured exit 0 with the command\'s own stdout intact, with and without `windowsHide`).',
404
+ ' ONE CONDITION RIDES WITH THAT: the runner must be spawned WITH a console, i.e. not with',
405
+ ' `DETACHED_PROCESS`. A real host alone is not enough if that flag is set (#8208) — the host binary is',
406
+ ' what supplies the console, and the spawn flag is what can take it away again.',
407
+ ' If no real node host can be put in front of the runner, the same effect fits inside it: `AllocConsole`',
408
+ ' before the restricted spawn, with the three standard handles restored afterwards, in',
409
+ ' `dsh-win32-process`\'s `createRestrictedProcess` — the funnel every restricted child goes through.',
410
+ ' #8208 measured `cmd /c exit` and `pwsh -c "Write-Output …"` both reaching 0 with stdout intact under',
411
+ ' that change, and as a no-op on a runner that already owns a console; it costs a `user32` binding and',
412
+ ' one console host per runner process.',
413
+ ' `danger-full-access` only CONFIRMS the diagnosis: on this platform it silently removes the sandbox',
414
+ ' from every shell call. Do not unset `ELECTRON_RUN_AS_NODE` instead either — the desktop runner IS',
415
+ ' that Electron binary, so dropping the variable would take `runner.js` down with it (#8193 records',
416
+ ' this interaction with #8174).',
391
417
  ]
392
418
  : [
393
419
  ' This process is NOT an Electron binary (`process.versions.electron` is unset), so the runner is a real',
394
- ' Node binary here and that producer cannot be the cause. If the program was not an MSYS2 one either,',
395
- ' this failure is outside both measured producers: stop and hand it to the user.',
420
+ ' Node binary here and a GUI-subsystem host cannot be the cause. One measured shape is still open: a',
421
+ ' runner that owns no console because it was spawned with `DETACHED_PROCESS` fails exactly this way on a',
422
+ ' real node host too (#8208) — that is a property of how this host was launched, not of the build. If the',
423
+ ' program was not an MSYS2 one either, and the runner was not spawned detached, this failure is outside',
424
+ ' both measured producers: stop and hand it to the user.',
396
425
  ]),
397
426
  '',
398
427
  'Do not retry this call: the environment has not changed, and the identical call produces the identical',
399
428
  'code. Convert the work only in case 1; otherwise stop and hand it to the user.',
400
429
  '',
401
430
  'Honest boundary — 0xC0000142 has producers this list does not have: a program that cannot load one of',
402
- 'its own DLLs dies this way too, and the backend\'s own source records that a child created with a hidden',
403
- 'console window can as well (`CREATE_NO_WINDOW` can fail restricted-token DLL initialization). #8193',
404
- 'refines that recording rather than repeating it: `CREATE_NO_WINDOW` is not among the flags actually passed',
405
- '(they are `CREATE_SUSPENDED`, and `CREATE_SUSPENDED | CREATE_UNICODE_ENVIRONMENT` on the unrestricted',
406
- 'path), and the same flags succeed under a real-node host — so the flag is a necessary ingredient and the',
407
- 'host process image is what turns it fatal. This is not a claim that the sandbox caused the failure — the',
408
- 'code cannot say that. What is claimed is narrower and checkable: the process never reached its entry',
409
- 'point, and under this mode these two producers are known.',
431
+ 'its own DLLs dies this way too, and the backend\'s own source records the console case as an inherent',
432
+ 'limit of the backend (`CREATE_NO_WINDOW` / `CREATE_NEW_CONSOLE` children die with `STATUS_DLL_INIT_FAILED`',
433
+ 'under the restriction). #8208 explains that limit instead of repeating it, and the explanation is what the',
434
+ 'two shapes above share: in a restricted token a console can be INHERITED but not CREATED. The creation',
435
+ 'flags actually passed are three sets and none of them is `CREATE_NO_WINDOW` — `0` on the piped path,',
436
+ '`CREATE_SUSPENDED` on the inherited-job path, and `CREATE_SUSPENDED | CREATE_UNICODE_ENVIRONMENT` on the',
437
+ 'ordinary path. Those same flags are fatal under a console-less runner and harmless under one that owns a',
438
+ 'console, so it is the console and not the flag list that decides.',
439
+ '',
440
+ 'One arm of this family was applied, measured, and rejected — named so a reader does not reach for it:',
441
+ 'putting `DETACHED_PROCESS` on the RESTRICTED CHILD removes its console request and does stop the crash,',
442
+ 'but `pwsh` then exits 0 with zero bytes on stdout AND stderr, while `cmd.exe` keeps its output (#8208).',
443
+ 'That trades a loud failure for a silent one on the interpreter most likely to be used, so the runner-side',
444
+ 'remedies above — which keep the output — are the ones to take.',
445
+ '',
446
+ 'This is not a claim that the sandbox caused the failure — the code cannot say that. What is claimed is',
447
+ 'narrower and checkable: the process never reached its entry point, and under this mode these producers are',
448
+ 'known.',
410
449
  '',
411
450
  'This is a stopgap, ' + where + '. What it is NOT: this plugin neither changes an environment nor',
412
451
  'widens the sandbox — the checks above are yours to make, and `danger-full-access` is not offered as a fix.',
@@ -58,12 +58,21 @@
58
58
  * is guess which producer this is: the code alone cannot say, and the two
59
59
  * checks it hands over are facts the reader holds (what program they ran;
60
60
  * whether this is the packaged desktop app, which the plugin reports rather
61
- * than assumes). That Electron host is itself **two measurements**, not one —
62
- * a runner that never started at all, and a runner that did start and whose
63
- * child cannot survive the restricted token derived from an Electron process
64
- * image — and the advisory names both instead of asserting the one it shipped
65
- * first, because a session cannot tell them apart and a confidently wrong
66
- * cause is worse than two named ones with one shared remedy.
61
+ * than assumes). That Electron host was shipped as **two measurements**; since
62
+ * 0.8.0 it is **one mechanism, named**: the runner must own a *console* for the
63
+ * confined child to inherit, and when it owns none the child's own console
64
+ * request is denied under the restricted token (`#8208` traced it to
65
+ * `conhost.exe` created by the restricted child, exiting `STATUS_ACCESS_DENIED`).
66
+ * The two measured console-less shapes are a GUI-subsystem host image (the
67
+ * packaged desktop) and a `DETACHED_PROCESS` runner under a real `node.exe`
68
+ * host — the second reproducible on any machine, which is what makes it the
69
+ * check worth handing over. The shape 0.7.x led with, "the runner never started
70
+ * at all", is **withdrawn**: the desktop's own host child is started with
71
+ * `ELECTRON_RUN_AS_NODE=1` (`apps/desktop/src/host-process.ts` ->
72
+ * `desktopNodeEnvironment()`), so nothing on the runner path fails to start for
73
+ * want of that variable. A withdrawn cause earns its sentence because this
74
+ * advisory shipped it twice; a confidently wrong cause is worse than two named
75
+ * ones with one shared remedy.
67
76
  *
68
77
  * Both give a **discriminator, not just a remedy**: applying a fix without
69
78
  * confirming the cause teaches nothing when the fix does not work. For the ACL
@@ -88,7 +97,7 @@ export declare const ACL_DISCUSSIONS = "#7538 / #7622 / #7646 / #7720 / #7750 /
88
97
  /** The upstream thread the persistent-shell advisory is a stopgap for. */
89
98
  export declare const PTY_DISCUSSIONS = "#7638";
90
99
  /** The upstream threads the native-init-death advisory is a stopgap for. */
91
- export declare const NATIVE_INIT_DISCUSSIONS = "#7876 / #7877 / #8193";
100
+ export declare const NATIVE_INIT_DISCUSSIONS = "#7876 / #7877 / #8193 / #8208";
92
101
  /** The documented prerequisite, quoted from the backend's README. */
93
102
  export declare const PREREQUISITE = "granted directories must be caller-owned and grant `WRITE_OWNER`";
94
103
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@argszero/cordis-plugin-sandbox-grant-advisor",
3
3
  "description": "Turns three sandbox environment failures that name neither their cause nor a remedy into a diagnosis with a path forward. Family 1, the Windows workspace ACL: nine reports (#7538, #7622, #7646, #7720, #7750, #7735, #7771, #7804, #7816) of one signature \u2014 every sandboxed command fails before it runs with `SetNamedSecurityInfoW failed (Win32 5): grantWrite(<workspace>)`, because the merged DACL + mandatory-label write needs WRITE_OWNER on the directory (an object right the caller can self-grant), not SeSecurityPrivilege and not elevation; the host grant is materialized lazily and caches nothing on the failure path, so the same failure repeats per command. Family 2, the persistent shell (#7638): with the `minimal` preset under a confining sandbox mode every shell call dies instantly with `PTY shell exited during startup` because the terminal backend cannot create the pseudo-console inside the sandbox, retrying never helps, and `minimal` mounts no fallback shell tool. Family 3, a confined Windows child that died during native initialization (#7876, #7877): every command spawned through the sandbox runner can report exit 0xC0000142 STATUS_DLL_INIT_FAILED with the process never reaching its entry point \u2014 the packaged desktop starts that runner as [process.execPath, entry], and that host has been measured twice with one indistinguishable appearance from inside a session \u2014 either nothing on the runner path ran because the Electron binary launches as an application unless the child's environment carries ELECTRON_RUN_AS_NODE=1 (#7876), or the desktop launcher does set that variable and the child still dies because the restricted token is derived from the Electron process image (#8193), and an MSYS2 / Git-Bash program cannot create its signal pipe under the restricted token while cmd.exe and pwsh run fine in the same workspace under the same mode (#7877) \u2014 and because upstream's runner-failure rules admit only exit 127 with the `windows-acl-run: ` signature, the code is never an error: it arrives as the canonical value of a result the pipeline calls a success. The plugin observes the public `tools/post-execute` waterfall, classifies all three signatures narrowly (only the two `...NamedSecurityInfoW` operations; the PTY message matched on a whole line, never as a substring; the loader status read as a 32-bit integer out of the shell tool's own canonical success value, never from rendered text; both mode-gated families advised only under a mode the policy resolver reports as confining), and attaches ONE durable user-role advisory per agent per family through `additionalContexts`. The ACL advisory names the missing right, both environments the identical text can describe (an inherited Modify-only entry, a data volume where no ACE names the caller at all, and a directory owned by another account), the version boundary that arrived with the mandatory label (0.1.7-alpha.1, flag 20, versus the DACL-only flag 4 up to 0.1.6-alpha.x) together with why downgrading is not the remedy, the discriminator, the remedy forked on an ownership check the user runs (`(Get-Acl \"<dir>\").Owner`), because one command cannot serve both rights situations: where the caller owns the directory, the unelevated `icacls ... :(OI)(CI)(WO)` is the whole of what is missing \u2014 the owner's implicit WRITE_DAC already covers the DACL half \u2014 and where the caller does not own it that same command is refused for want of WRITE_DAC, so the grant has to come from an elevated account, or by taking ownership first, or by moving the workspace under %USERPROFILE% \u2014 and the two remedies that look right and are not (`takeown`, `icacls /reset`), each with the reason it fails; the PTY advisory names the failing combination, states the resolved mode, tells the model to stop rather than retry, and hands the user-side preset choice over \u2014 it never names a shell tool the failing composition does not mount; the native-init advisory states the resolved mode, says the process died before its entry point, enumerates the two producers measured under a confining mode \u2014 naming both measured shapes of the desktop host rather than asserting the one that was measured first \u2014 with the check that separates them (what program the reader ran; whether this host is the packaged desktop binary, which the plugin measures and reports rather than assumes), carries the one conversion a model can make itself (rewrite the work as PowerShell or `cmd` when an MSYS2 program is what could not start), and \u2014 for the Electron host \u2014 names the fix #8193 measured rather than a wider mode: host the runner on a real node.exe (the desktop ships one under `resources/runtime/primary-runtime/dependencies/node/bin/node.exe`), where the same confined `pwsh`/`cmd` spawns succeed, while `danger-full-access` is described as a way to confirm the diagnosis and not a fix, together with the warning that unsetting `ELECTRON_RUN_AS_NODE` instead would leave the desktop's Electron-hosted runner unable to execute `runner.js` at all (the interaction #8193 records with #8174), and says plainly which producers it does not know \u2014 it never claims the sandbox caused the failure and never offers a widened mode as a fix. An optional, off-by-default `enforceAfter` refuses an identical ACL call this plugin has watched fail, bounded by `maxDenials`; the blocking half is ACL-only by design. It never edits an ACL, never elevates, never sets another process's environment, and never changes a preset or a mode, and it complements repeat-guard-escalation, which keys on call identity rather than on the environment signature.",
4
- "version": "0.7.1",
4
+ "version": "0.8.0",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/types/index.d.ts",