@argszero/cordis-plugin-sandbox-grant-advisor 0.12.0 → 0.14.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
@@ -46,8 +46,9 @@ inherited `Authenticated Users: Modify` is the whole of their access). In each o
46
46
  every sandboxed command fails the same way, before it runs, and the error names
47
47
  neither the missing right nor a remedy.
48
48
 
49
- Two further reports — [discussion #8312] and [discussion #8314] — describe the
50
- other end of the same backend: what its grant leaves behind *after* it applies.
49
+ Two further reports — [discussion #8312] and [discussion #8314] — and a third,
50
+ [discussion #8412], describe the other end of the same backend: what its grant
51
+ leaves behind *after* it applies.
51
52
  The advisory states that too (see [What the grant leaves behind](#what-the-grant-leaves-behind-added-in-0100)),
52
53
  because the advisory is the thing handing over the command that applies the grant.
53
54
 
@@ -183,6 +184,25 @@ Two consequences follow from that one line:
183
184
  one of two independent layers. The advisory says this instead of a bare "no",
184
185
  because a reader told only "no" reaches for the workaround without knowing what
185
186
  else it has to change.
187
+ 7. **The missing right was confirmed from outside, unelevated** (added in 0.14.0,
188
+ from `#8426`). Everything above is argued from the backend's source; `#8426`
189
+ measured it with none of that. On a directory whose ACL named the account only
190
+ through the inherited `Authenticated Users:(M)` entry, asking that directory
191
+ for a Low mandatory-integrity label — the label half alone, no DACL write, so
192
+ it isolates the right the merged call wants — was **refused**, and the
193
+ identical operation **succeeded** the moment the same account granted itself
194
+ `(OI)(CI)F`, whose mask carries `WRITE_OWNER`, and was reversible from there
195
+ (back to Medium works just as well). No elevation anywhere in it. That makes the
196
+ claim in item 2 a measurement rather than a reading: the missing right is an
197
+ object right on the **directory**, not `SeRelabelPrivilege` and not a token
198
+ privilege. The same report then repaired two real trees the same way — object
199
+ right first, integrity label second, 9521 and 5592 objects, no failures — an
200
+ order that cannot be swapped, since the second step is the one that needs what
201
+ the first supplies, and it is the order the advisory's own remedy already
202
+ follows. The probe itself is quoted here and **not** in the advisory, for the
203
+ reason item 6 of the `#8272` paragraph above gives: a label write is not a
204
+ check, because where the caller already holds Full control it succeeds and
205
+ writes the label. The advisory hands over only the two read-only checks.
186
206
 
187
207
  The grant is materialized lazily, on the first confined call, and **nothing is
188
208
  cached when it throws** — so the same failure repeats per command (850 calls
@@ -653,7 +673,7 @@ the single shape that happened to be measured first. It never
653
673
  offers `danger-full-access` as a fix and never suggests a sandbox setting be
654
674
  relaxed.
655
675
 
656
- ### 4. Denied inside the workspace (`workspace-denial`, added in 0.11.0)
676
+ ### 4. Denied inside the workspace (`workspace-denial`, added in 0.11.0; the branches it forks into in 0.13.0 and 0.14.0)
657
677
 
658
678
  [#423] is one report and its own follow-up, and it is the **other end of the
659
679
  backend §1 is about**. There the workspace grant could not be applied at all and
@@ -707,14 +727,62 @@ reading of its own sandbox, not a guess about a line of output.
707
727
  `Administrators`/`SYSTEM` plus the capability SID is refused on the read side
708
728
  too, and looks fine to a check that merely greps for the capability SID.
709
729
  [#423] measured exactly that on a `.cache` directory.
710
- - **The second measured variant of the same shape.** The coverage that is
711
- missing can be the mandatory-integrity **label** rather than a DACL entry —
712
- reported in the same thread on 2026-09-29, against a `0.2.0-rc.1` install,
713
- under the same root-only short-circuit. From inside a session the two are
714
- indistinguishable; from outside, the repository's own diagnosis skill
715
- separates them (`diagnose-windows-sandbox-acl`, 0.2.0 and later, reports
716
- `hasExactDeny()` for the DACL half and `LOW_LABEL` — `S-1-16-4096` — for the
717
- label half).
730
+ - **The fork, and the other two branches** (the second added in 0.13.0 from
731
+ [#8383] and its second instance [#8421]; the third in 0.14.0 from [#8409]). The
732
+ grant and the mandatory-integrity **label** go out in the same single
733
+ security-descriptor write, and that write lands on the workspace root (plus
734
+ the session's private temp directory) with **no descendant walk** — so the
735
+ label half can fail to reach the tree while the DACL half arrives at every
736
+ level, and it produces the identical denial. The backend's root-only
737
+ idempotency check then requires the grant, the world delete-child deny **and**
738
+ the exact label (`hasExactGrant()` + `hasExactDeny()` + `hasExactLabel()` all
739
+ matching, `acl.ts:386-388`, label read at `:198-204`) before it returns early,
740
+ so once the root is labelled the propagation is never attempted again and an
741
+ unlabelled child is never revisited — the same root-only short-circuit as the
742
+ DACL half, on the other half of the same call. From inside a session the
743
+ branches are indistinguishable, so the advisory forks them on **breadth**, the
744
+ one fact the reader already owns: a **handful** of stubborn objects while the
745
+ rest of the tree writes normally is the DACL branch, **nothing below the root
746
+ writable at all** with the root itself the only writable place is the label
747
+ branch, and **the root itself refused** — nothing writable, not even the root —
748
+ is a third branch with a different cause and a different remedy (below). A
749
+ Low-integrity child may write to a directory only if that directory's own label
750
+ is Low — the kernel's no-write-up check runs *in addition to* the access check
751
+ — so a DACL that is perfect everywhere changes nothing. [#8383] measured it on
752
+ `0.2.0-rc.2` with the decisive control of a directory created **after** the
753
+ grant: it inherits the capability ACE marked `(I)` and still gets no label.
754
+ (The report's own care is worth keeping: a *grandchild* directory having no
755
+ label proves nothing, because inheritance is per-parent and the intermediate
756
+ directory carries none — only a **direct** child of the labelled root is
757
+ evidence.) From outside a session the repository's own diagnosis skill
758
+ separates the DACL half from the label half (`diagnose-windows-sandbox-acl`,
759
+ 0.2.0 and later, prints the owner, the caller's rights and
760
+ `WRITE_DAC`/`WRITE_OWNER` for the one and `LOW_LABEL` — `S-1-16-4096` — for the
761
+ other). And a widened DACL does not clear the label half either, because the
762
+ refusal precedes the ACL: [#8383] confirmed that adding an explicit
763
+ `FullControl` entry for the user on a subdirectory still left the write denied.
764
+ - **The third branch, and the one recovery this family has** (added in 0.14.0,
765
+ from [#8409]). The root's own standing grant can be **gone**: the workspace
766
+ root's security descriptor rewritten from outside the harness (an ACL reset, a
767
+ restored descriptor, a tool that re-applies one) leaves nothing writable, the
768
+ root included. It is not a descendant missing an inherited ACE — it is the ACE
769
+ the harness itself wrote that is no longer there — and the reason no retry
770
+ reaches it is one layer **above** the backend's own check: the session-scoped
771
+ provider materializes the root ACE once per **provider lifetime** and keeps the
772
+ root in its own in-memory map, consulting the map instead of the DACL
773
+ thereafter (`sandbox-local/src/index.ts`: the guard at `:403-421`,
774
+ "materializes once per workspace per server lifetime"), so the `hasExactGrant`
775
+ check the other two branches turn on is not even reached again. The
776
+ discriminator is measured on both paths and is a fact about where the cache
777
+ lives, not about one path being more careful: the agentless/runner invocation
778
+ passes no session id (`windowsAclRunnerArgv()`), so the runner owns the DACLs
779
+ and re-applies the grant on **every** spawn — which really does read the DACL —
780
+ and heals by itself, while the desktop session does not. The recovery is the
781
+ only one this family has and it is the **user's**, not a command: restart the
782
+ provider (quit and reopen the desktop app, or open the workspace in a fresh
783
+ one), which empties the map and lets the next provision read the DACL, find the
784
+ ACE absent and write it — the reporter measured exactly that ("restarting the
785
+ desktop brings it back").
718
786
  - **No repair command.** The obvious one, a recursive `icacls /grant` for the
719
787
  capability SID, is refused by Windows itself with `ERROR_NONE_MAPPED` (1332) —
720
788
  the tool cannot map that SID to a name, so a grant that must name it never
@@ -1045,6 +1113,7 @@ the current runtime cannot distinguish rather than counting it as a pass.
1045
1113
  [discussion #8232]: https://github.com/deepseek-ai/deepseek-harness/discussions/8232
1046
1114
  [discussion #8272]: https://github.com/deepseek-ai/deepseek-harness/discussions/8272
1047
1115
  [discussion #8275]: https://github.com/deepseek-ai/deepseek-harness/discussions/8275
1116
+ [discussion #8412]: https://github.com/deepseek-ai/deepseek-harness/discussions/8412
1048
1117
  [discussion #7638]: https://github.com/deepseek-ai/deepseek-harness/discussions/7638
1049
1118
  [discussion #7876]: https://github.com/deepseek-ai/deepseek-harness/discussions/7876
1050
1119
  [discussion #7877]: https://github.com/deepseek-ai/deepseek-harness/discussions/7877
@@ -1073,3 +1142,8 @@ the current runtime cannot distinguish rather than counting it as a pass.
1073
1142
  [#8322]: https://github.com/deepseek-ai/deepseek-harness/discussions/8322
1074
1143
  [#8334]: https://github.com/deepseek-ai/deepseek-harness/discussions/8334
1075
1144
  [#8336]: https://github.com/deepseek-ai/deepseek-harness/discussions/8336
1145
+ [#8383]: https://github.com/deepseek-ai/deepseek-harness/discussions/8383
1146
+ [#8409]: https://github.com/deepseek-ai/deepseek-harness/discussions/8409
1147
+ [#8412]: https://github.com/deepseek-ai/deepseek-harness/discussions/8412
1148
+ [#8421]: https://github.com/deepseek-ai/deepseek-harness/discussions/8421
1149
+ [#8426]: https://github.com/deepseek-ai/deepseek-harness/discussions/8426
package/cordis.patch.yml CHANGED
@@ -38,6 +38,16 @@
38
38
  # `diagnose-windows-sandbox-acl` repair arrives with the `0.2.0` line. Neither
39
39
  # makes downgrading a fix, and repairing the `0.1.7` file list is not a thing
40
40
  # that can be done — there is nothing in that release to list.
41
+ # - the missing right confirmed from outside (#8426): asking a directory that
42
+ # names the account only through the inherited `Authenticated Users:(M)`
43
+ # entry for a Low mandatory-integrity label is refused unelevated — the label
44
+ # half alone isolates the right the merged call wants — and the identical
45
+ # operation succeeds the moment that account grants itself `(OI)(CI)F`, so the
46
+ # missing right is a right on the directory, not `SeRelabelPrivilege` and not
47
+ # elevation. The same report repaired two trees object-right-first and
48
+ # label-second (9521 and 5592 objects, no failures), the order the advisory's
49
+ # own remedy already follows. The probe is not offered as a check: a label
50
+ # write is not a read.
41
51
  #
42
52
  # The advisory also says why a "weaker grant" is not a smaller version of the
43
53
  # same one, because that is the next idea the diagnosis invites: the label rides
@@ -45,8 +55,8 @@
45
55
  # the confined token is itself lowered to Low, so the directory's Low label is
46
56
  # what lets that child write there at all.
47
57
  #
48
- # And it says WHAT THE GRANT LEAVES BEHIND once it applies (#8312, #8314): the
49
- # three entries are STANDING and nothing revokes them (the backend's own dispose
58
+ # And it says WHAT THE GRANT LEAVES BEHIND once it applies (#8312, #8314, #8412):
59
+ # the three entries are STANDING and nothing revokes them (the backend's own dispose
50
60
  # and fail-closed paths leave them — "the intended end state (the reuse cache)"),
51
61
  # the Low integrity label is INHERITABLE and lives in the SACL (so `icacls /reset`
52
62
  # does not remove it — that rebuilds the DACL), a process starts at
@@ -136,18 +146,19 @@
136
146
  # with why a windowless console is still an inheritable console. Like the second
137
147
  # family, it is mode-gated.
138
148
  #
139
- # A FOURTH family is the other half of the FIRST one's backend (#423). There the
140
- # grant could not be applied at all; here it WAS applied — on the workspace root,
141
- # once — and Windows ACE inheritance silently skipped the objects whose DACL the
142
- # caller could not write, so commands writing into a subdirectory created or moved
143
- # in from outside (an installer, an editor, another harness under its own account)
144
- # are denied forever while the same command against a directory the harness itself
145
- # created succeeds. The backend's provisioning check short-circuits on the root
146
- # (`hasExactGrant` returns early once the root carries the ACE), so those
147
- # descendants are never revisited. It is read from a value rather than from text,
148
- # like the third family and for the same reason (a denial exits nonzero and the
149
- # shipped shell tools report that as a finished run), but it needs no bespoke code:
150
- # the executors stamp the denial onto the value as
149
+ # A FOURTH family is the other half of the FIRST one's backend (#423, #8383,
150
+ # #8421, #8409). There the grant could not be applied at all; here it WAS applied
151
+ # — on the workspace root, once — and Windows ACE inheritance silently skipped the
152
+ # objects whose DACL the caller could not write, so commands writing into a
153
+ # subdirectory created or moved in from outside (an installer, an editor, another
154
+ # harness under its own account) are denied forever while the same command against
155
+ # a directory the harness itself created succeeds. The backend's provisioning check
156
+ # short-circuits on the root (the grant, the world delete-child deny and the
157
+ # exact label must all match before it returns early), so those descendants are
158
+ # never revisited. It is read from a value rather than from text, like the third
159
+ # family and for the same reason (a denial exits nonzero and the shipped shell
160
+ # tools report that as a finished run), but it needs no bespoke code: the
161
+ # executors stamp the denial onto the value as
151
162
  #
152
163
  # sandbox: { mode: "workspace-write", denied: true }
153
164
  #
@@ -157,16 +168,45 @@
157
168
  # absolute path the command names lies inside the session's workspace: a denial
158
169
  # anywhere else (outside the workspace, under `read-only`, a runner failure) is
159
170
  # the sandbox working as designed and is left alone. The advisory prints the path
160
- # it keyed on beside the root it tested it against, says that retrying is provably
161
- # useless, gives the DISCRIMINATOR — reading/listing use the normal token while
162
- # writing/deleting use the restricted one, and both sides must pass, so an object
163
- # whose DACL names only Administrators/SYSTEM plus the capability SID looks granted
164
- # to a check that just greps for the SID — names the second measured variant of
165
- # the same shape (the coverage missing on the mandatory-integrity LABEL rather
166
- # than on the DACL, separated from outside a session by the repository's own
167
- # `diagnose-windows-sandbox-acl`), and states the Windows ceiling that closes the
168
- # obvious repair (a recursive `icacls /grant` for a capability SID is refused with
169
- # ERROR_NONE_MAPPED (1332), because that SID has no name to map). It ships NO
171
+ # it keyed on beside the root it tested it against and says that retrying is
172
+ # provably useless — and then, before any check, forks the diagnosis on BREADTH,
173
+ # the one fact the reader already owns:
174
+ #
175
+ # - a HANDFUL of stubborn objects while the rest of the tree writes normally →
176
+ # the DACL branch (#423: the capability ACE did not arrive at those objects),
177
+ # with the two-sided discriminator that a single check gets wrong — reading
178
+ # and listing use the normal token while writing and deleting use the
179
+ # restricted one, so an object whose DACL names only Administrators/SYSTEM
180
+ # plus the capability SID looks granted to a check that merely greps for the
181
+ # SID;
182
+ # - NOTHING below the root writable at all, the root itself the only writable
183
+ # place → the LABEL branch (#8383, second instance #8421; measured on
184
+ # 0.2.0-rc.2 with the decisive control of a directory created after the grant):
185
+ # the DACL is present and inherits correctly at every level while the Low
186
+ # mandatory-integrity label never reaches the children, so the kernel's
187
+ # no-write-up check refuses the Low-integrity child before the ACL is ever
188
+ # consulted — same permanent shape (the label goes out in the same single
189
+ # security-descriptor write as the grant, only on the paths the backend
190
+ # enumerates, with no descendant walk), separable from outside a session by
191
+ # the repository's own `diagnose-windows-sandbox-acl` and its `LOW_LABEL`
192
+ # (`S-1-16-4096`) report;
193
+ # - THE ROOT ITSELF REFUSED, nothing writable, not even the root → a third
194
+ # shape, and the only branch of this family with a recovery inside the product
195
+ # (#8409). The standing grant is gone from the root's own DACL — rewritten
196
+ # from outside the harness — and the layer that would put it back has stopped
197
+ # looking: the session-scoped provider materializes the root ACE once per
198
+ # provider lifetime and consults its own in-memory map afterwards without
199
+ # ever re-reading the DACL, while the agentless/runner path passes no session
200
+ # id, owns the DACLs itself and re-applies the grant on every spawn — which
201
+ # is why that path heals and this one does not. No command reaches it; the
202
+ # move is the user's and it is the provider, not the ACL: restart the desktop
203
+ # app or open the workspace in a fresh one, which empties the map and lets the
204
+ # next provision re-read the DACL and rewrite the missing ACE.
205
+ #
206
+ # It also states the Windows ceiling that closes the obvious repair (a recursive
207
+ # `icacls /grant` for a capability SID is refused with ERROR_NONE_MAPPED (1332),
208
+ # because that SID has no name to map; and a manually widened DACL does not clear
209
+ # the label half either, because the refusal precedes the ACL). It ships NO
170
210
  # repair command, for the reason the standing-grant section ships none: this
171
211
  # project has no Windows host to verify a line on.
172
212
 
package/lib/advice.js CHANGED
@@ -132,11 +132,16 @@
132
132
  * normal token while writing and deleting use the restricted one, so an object
133
133
  * whose DACL names only `Administrators`/`SYSTEM` plus the capability SID is
134
134
  * refused on the read side too and looks granted to a grep for the SID
135
- * (#423 measured it). The variant that would otherwise be missed gets its own
136
- * sentence as well — the same shape with the missing coverage on the mandatory
137
- * label instead of the DACL (reported 2026-09-29 in the same thread), which is
138
- * indistinguishable from inside a session and separable by the repository's own
139
- * diagnosis skill.
135
+ * (#423 measured it). And the second branch is now **first-class rather than a
136
+ * sentence**: the same root-only short-circuit on the *label* half, where the
137
+ * DACL reaches every object and the mandatory-integrity label reaches none of
138
+ * the subdirectories, so nothing below the root is writable at all (`#8383`,
139
+ * measured against `0.2.0-rc.2` with the decisive control of a directory
140
+ * created *after* the grant). The two branches are indistinguishable from
141
+ * inside a session and permanent for the same reason, so the text forks them
142
+ * on **breadth** — the one fact the reader already owns — before it hands over
143
+ * any check, and separates them from outside by the repository's own
144
+ * `diagnose-windows-sandbox-acl` and its `LOW_LABEL` report.
140
145
  *
141
146
  * Both give a **discriminator, not just a remedy**: applying a fix without
142
147
  * confirming the cause teaches nothing when the fix does not work. For the ACL
@@ -156,7 +161,10 @@
156
161
  * against: the reader can audit the plugin's own reasoning instead of taking a
157
162
  * claim about two strings on faith. That family's check is also the one place
158
163
  * where a single fact is not enough — reachability has two sides, and the text
159
- * says which one a check on the ACE alone would miss.
164
+ * says which one a check on the ACE alone would miss — and it is the one family
165
+ * with a **second cut before the check**: which half is missing is settled by how
166
+ * MUCH of the tree is affected, because a reader who repairs the DACL of a
167
+ * label-starved workspace has spent a privilege for nothing.
160
168
  *
161
169
  * @module
162
170
  */
@@ -165,12 +173,19 @@ import { failureLine, STATUS_DLL_INIT_FAILED } from './signature.js';
165
173
  * The upstream threads the ACL advisory is a stopgap for.
166
174
  *
167
175
  * The first twelve report the provisioning failure itself (the merged DACL +
168
- * label write being refused). The last two, `#8312` and `#8314`, report the
169
- * other end of the same backend — what its grant leaves behind once it
170
- * *succeeds* — which the advisory states because it is the fact a reader needs
171
- * at the moment it hands them the command that applies that grant.
176
+ * label write being refused). `#8312` and `#8314` report the other end of the
177
+ * same backend — what its grant leaves behind once it *succeeds* — which the
178
+ * advisory states because it is the fact a reader needs at the moment it hands
179
+ * them the command that applies that grant. The last three arrived later and
180
+ * are all inside the same advisory: `#8426` is the independent, unelevated
181
+ * measurement of the missing `WRITE_OWNER` the diagnosis above had only ever
182
+ * argued for, and `#8412` is a second instance of what the grant leaves behind
183
+ * (the standing Low label reaching programs the user launches themselves).
184
+ * `#8409` is the same backend once more and belongs to both lists: one of its
185
+ * three defects is the provisioning failure this family explains, and another
186
+ * is the fourth family's third branch.
172
187
  */
173
- export const ACL_DISCUSSIONS = '#7538 / #7622 / #7646 / #7720 / #7750 / #7735 / #7771 / #7804 / #7816 / #8232 / #8272 / #8275 / #8312 / #8314';
188
+ export const ACL_DISCUSSIONS = '#7538 / #7622 / #7646 / #7720 / #7750 / #7735 / #7771 / #7804 / #7816 / #8232 / #8272 / #8275 / #8312 / #8314 / #8426 / #8412 / #8409';
174
189
  /**
175
190
  * The upstream threads the persistent-shell advisory is a stopgap for.
176
191
  *
@@ -191,15 +206,21 @@ export const PTY_DISCUSSIONS = '#7638 / #8322';
191
206
  */
192
207
  export const NATIVE_INIT_DISCUSSIONS = '#7876 / #7877 / #8193 / #8208 / #8313 / #8336 / #8334';
193
208
  /**
194
- * The upstream thread the workspace-denial advisory is a stopgap for.
209
+ * The upstream threads the workspace-denial advisory is a stopgap for.
195
210
  *
196
- * One thread, because this family is one report and its own follow-up: `#423`
197
- * is the failure and its measurements (170 of 729 objects missing the grant,
198
- * root-level files among them, and the two-sided reachability rule), and the
199
- * second comment in that thread is the mandatory-label variant of the same
200
- * shape.
211
+ * `#423` is the failure and its first measurements: 170 of 729 objects missing
212
+ * the grant, root-level files among them, and the two-sided reachability rule.
213
+ * Its second comment named the mandatory-label variant of the same shape, which
214
+ * `#8383` then measured on its own — the exact complement, with the DACL
215
+ * present and inheriting correctly at every level while the label reaches none
216
+ * of the subdirectories, so the variant stopped being a footnote and became the
217
+ * second branch the discriminator forks into; `#8421` met it again, which is
218
+ * why the branch reads as a shape rather than as one install. `#8409` is the
219
+ * third branch's source and a report of the DACL half as well: the workspace
220
+ * root's own standing grant can be gone, and the layer that would re-apply it
221
+ * consults a per-lifetime map instead of the DACL, so nothing notices.
201
222
  */
202
- export const WORKSPACE_DENIAL_DISCUSSIONS = '#423';
223
+ export const WORKSPACE_DENIAL_DISCUSSIONS = '#423 / #8383 / #8421 / #8409';
203
224
  /**
204
225
  * The thread list each family's withholding note cites.
205
226
  *
@@ -412,6 +433,61 @@ function degradedGrant() {
412
433
  'This is not offered here as a fix, and neither is `danger-full-access`.',
413
434
  ];
414
435
  }
436
+ /**
437
+ * The independent measurement of the missing right, from `#8426`.
438
+ *
439
+ * Everything above is argued from the backend's own source — the merged
440
+ * security-information flags, the owner's implicit rights, the mask an inherited
441
+ * `Authenticated Users` entry carries. A reader is entitled to a measurement
442
+ * taken by someone who had none of that, and `#8426` is one: on a directory
443
+ * whose ACL named the account only through that inherited Modify entry, asking
444
+ * the directory for a Low mandatory-integrity label — the label half alone, no
445
+ * DACL write, so it isolates the right the merged call wants — was refused, and
446
+ * the same operation succeeded the moment that account granted itself
447
+ * `(OI)(CI)F`, whose mask carries `WRITE_OWNER`. Unelevated throughout, and
448
+ * reversible afterwards (the level moved back to Medium just as easily). That is
449
+ * the missing right demonstrated from outside this project's reading, and it is
450
+ * a right on the **directory**: no `SeRelabelPrivilege`, no token privilege, no
451
+ * elevation.
452
+ *
453
+ * The command itself is deliberately **not** printed here, and that is a
454
+ * decision rather than an omission — the same one the `#8272` paragraph of the
455
+ * README records. A label write is not a check: where the caller holds Full
456
+ * control it SUCCEEDS, and then the label and its inheritance are already
457
+ * written. This module hands over only operations that are safe to run when they
458
+ * succeed, which is why the two checks above are reads. The evidence is what the
459
+ * report measured; the probe stays in the report.
460
+ *
461
+ * The same report then repaired two real trees the same way — object right
462
+ * first, integrity label second, 9521 and 5592 objects, no failures. The order
463
+ * is not interchangeable and is worth stating: the second step is the one that
464
+ * needs what the first supplies. Both halves are already in the advisory's own
465
+ * remedy, in the same order.
466
+ *
467
+ * The contrast with the workspace-denial family is deliberate. There the
468
+ * recursive grant cannot be hand-written at all, because the SID it must name
469
+ * has no name to map (`ERROR_NONE_MAPPED`, 1332), which is why that advisory
470
+ * forks on breadth instead of handing over a line.
471
+ * @returns the section's lines.
472
+ */
473
+ function writeOwnerEvidence() {
474
+ return [
475
+ 'A second confirmation, measured by a reporter who had none of the reasoning above (#8426) — unelevated, on a',
476
+ 'directory whose ACL named the account only through the inherited `Authenticated Users:(M)` entry: asking that',
477
+ 'directory for a Low mandatory-integrity label — the LABEL half on its own, with no DACL write, so it isolates',
478
+ 'the one right this call wants — was refused, and the identical operation stopped being refused the moment the',
479
+ 'same account granted itself `(OI)(CI)F`, whose mask carries WRITE_OWNER: same account, same elevation,',
480
+ 'succeeding at once, and reversible from there (the level moves back to Medium just as easily).',
481
+ 'So the missing right is a right on this DIRECTORY, exactly as the diagnosis above reads it: no',
482
+ 'SeRelabelPrivilege, no token privilege, no elevation anywhere in that measurement. (That probe is not printed',
483
+ 'here and is not offered as a check: a label write is not a read — where the caller already holds Full control',
484
+ 'it succeeds, and then the label and its inheritance are written. This module hands over only the two reads',
485
+ 'above.) The same report repaired two real trees that way — object right first, integrity label second, 9521',
486
+ 'and 5592 objects, no failures — an order that cannot be swapped, since the second step is the one that needs',
487
+ 'what the first supplies; which is why the remedy below grants first and lets the backend write the label.',
488
+ '',
489
+ ];
490
+ }
415
491
  /**
416
492
  * What the grant leaves behind once it applies, and how far its label travels.
417
493
  *
@@ -537,6 +613,7 @@ function aclAdvisory(failure, href) {
537
613
  '(WO) / Write owner. If the strongest entry naming you is (M) / Modify — or no entry names you at all and',
538
614
  'your access comes from an inherited `Authenticated Users:(M)` — that is this failure.',
539
615
  '',
616
+ ...(failure.klass === 'apply-denied' ? writeOwnerEvidence() : []),
540
617
  'Ownership decides which of the two commands below can work, so read it first — PowerShell 5.1 or later:',
541
618
  ` (Get-Acl "${path}").Owner # compare with: whoami`,
542
619
  'If that is not your own account, take the second branch: the first one is refused before it runs.',
@@ -804,19 +881,25 @@ function ptyAdvisory(failure, mode, tool, href) {
804
881
  * against**, because the family's claim is a statement about two strings and the
805
882
  * reader is entitled to audit it. It must give the **two-sided** reachability
806
883
  * rule, since a check that only looks for the capability ACE reports an object
807
- * as granted when the read side is refused as well. And it must name the
808
- * **label variant** of the same shape, because from inside a session the two are
809
- * indistinguishable and a reader who repairs the wrong half has learned
810
- * nothing.
811
- *
812
- * What it must not do is print a repair command. The obvious one is refused by
813
- * Windows with `ERROR_NONE_MAPPED` (1332) — a capability SID has no name for
814
- * `icacls` to map — and the one that would work needs `WRITE_DAC` on the object,
815
- * which is the right in question. This project has no Windows host to verify a
816
- * line on, and the standing-grant section of the ACL advisory is held to the
817
- * same standard for the same reason: an unverified remedy delivered confidently
818
- * is the defect this plugin exists to answer. The mechanism is stated instead,
819
- * and the reader is told why the command is absent.
884
+ * as granted when the read side is refused as well. And it must split the
885
+ * diagnosis into its **two branches** — the DACL entry that did not arrive, and
886
+ * the mandatory-integrity LABEL that did not (#8383) — because from inside a
887
+ * session they are indistinguishable, both are permanent for the same
888
+ * root-only-short-circuit reason, and a reader who repairs the wrong half has
889
+ * learned nothing. The fork is placed on **breadth**, which is the one fact the
890
+ * reader already has: a handful of stubborn objects is the DACL branch, and
891
+ * nothing below the root writable at all is the label branch.
892
+ *
893
+ * What it must not do is print a repair command. For the DACL branch the obvious
894
+ * one is refused by Windows with `ERROR_NONE_MAPPED` (1332) — a capability SID
895
+ * has no name for `icacls` to map — and the one that would work needs
896
+ * `WRITE_DAC` on the object, which is the right in question. For the label
897
+ * branch the shape of the move is a SACL write on the whole subtree, which needs
898
+ * the same class of object right and is not verified here either. This project
899
+ * has no Windows host to verify a line on, and the standing-grant section of the
900
+ * ACL advisory is held to the same standard for the same reason: an unverified
901
+ * remedy delivered confidently is the defect this plugin exists to answer. The
902
+ * mechanism is stated instead, and the reader is told why the command is absent.
820
903
  * @param failure - the recognized failure.
821
904
  * @param tool - the tool whose call was denied, when the caller knows it.
822
905
  * @param href - optional URL shown for the upstream thread.
@@ -829,7 +912,8 @@ function workspaceDenialAdvisory(failure, tool, href) {
829
912
  const call = tool === undefined ? 'This command' : `The \`${tool}\` command`;
830
913
  const subject = failure.paths[0] ?? '<the path from the error line above>';
831
914
  return [
832
- 'Denied inside your own workspace — the workspace grant does not reach that part of the tree, and retrying cannot repair it.',
915
+ 'Denied inside your own workspace — the access the workspace is supposed to carry does not cover that part of',
916
+ 'the tree, and retrying cannot repair it.',
833
917
  '',
834
918
  'What was reported:',
835
919
  ` ${failureLine(failure)}`,
@@ -837,8 +921,8 @@ function workspaceDenialAdvisory(failure, tool, href) {
837
921
  'path it named is inside this session\'s workspace:',
838
922
  ...failure.paths.map(path => ` ${path}`),
839
923
  ` (workspace root: ${failure.workspaceRoot})`,
840
- 'So this is not the sandbox declining work that belongs outside the workspace. It is the workspace\'s own grant',
841
- 'failing to cover an object inside it, which is why every command touching that object fails the same way.',
924
+ 'So this is not the sandbox declining work that belongs outside the workspace. It is the workspace\'s own access',
925
+ 'setup failing to cover an object inside it, which is why every command touching that object fails the same way.',
842
926
  '',
843
927
  'Why — and why retrying cannot fix it:',
844
928
  ' The host-side grant is written ONCE, on the workspace ROOT, and relies on Windows ACE inheritance to reach',
@@ -849,41 +933,133 @@ function workspaceDenialAdvisory(failure, tool, href) {
849
933
  ' therefore never revisited — not later in this session, not in any later one — so the identical command keeps',
850
934
  ' failing and there is no number of attempts that changes that',
851
935
  ' (`packages/sandbox/sandbox-windows-acl/src/acl.ts`).',
936
+ ' There is a second, higher skip, and it is the one the third branch below turns on: on a session-scoped',
937
+ ' workspace the layer that ASKS for the grant keeps its own per-lifetime map of the roots it has already',
938
+ ' provisioned and consults that map instead of the DACL, so for those roots the check above is not even reached',
939
+ ' again (`packages/sandbox/sandbox-local/src/index.ts`: the map guard at :403-421, "materializes once per',
940
+ ' workspace per server lifetime").',
852
941
  ' WHICH objects miss it is a fact about who created them: objects the harness itself creates inherit the ACE,',
853
942
  ' while objects that already existed or that another account or tool created (an installer, an editor, another',
854
943
  ' agent harness running under its own account) are the ones the propagation skipped. #423 measured 170 of 729',
855
944
  ' objects missing it, INCLUDING root-level files — so it is not only subdirectories, and "write it at the',
856
945
  ' workspace root instead" is not a safe move either.',
946
+ ' The same call also writes the mandatory-integrity LABEL, and that half can fail to reach the tree while the',
947
+ ' ACE half arrives — that is the second branch below, and it produces this identical denial. Both halves are',
948
+ ' permanent for the same reason, so settling WHICH one you are looking at comes before anything else.',
857
949
  '',
858
- 'Confirm it — this is the discriminator, and the second half is the part a single check gets wrong:',
950
+ 'Confirm it — and settle FIRST which of the three is missing, because all three produce this same denial and a',
951
+ 'reader who repairs the wrong one has learned nothing:',
859
952
  ` icacls "${subject}"`,
860
- 'compared with the same command against the workspace root. The root carries an inheritable ACE for the workspace',
861
- 'capability SID — a `S-1-4-…` that `icacls` prints as an unresolved SID rather than a name — with Modify or Full',
862
- 'control; the failing object does not have it. Check each path listed above the same way; the first is shown here.',
953
+ ` icacls "${failure.workspaceRoot}"`,
954
+ 'BREADTH IS THE FIRST CUT, and it needs no tool — it is what your own attempts have already shown:',
955
+ ' - A HANDFUL of stubborn objects while the rest of the tree writes normally → the DACL half. The capability ACE',
956
+ ' did not arrive at those objects; the workspace is otherwise usable. This is the #423 measurement.',
957
+ ' - NOTHING below the root is writable at all, with the root itself the only writable place → the LABEL half',
958
+ ' (#8383). A Low-integrity child may write to a directory only when that directory\'s own mandatory-integrity',
959
+ ' label is Low as well; the kernel runs its no-write-up check IN ADDITION to the access check, so a DACL that',
960
+ ' is perfect everywhere changes nothing.',
961
+ ' - THE ROOT ITSELF IS REFUSED — nothing writes, the root included, and work that used to succeed here now',
962
+ ' does not → NEITHER half above (#8409). The standing grant is gone from the root\'s own DACL, and the layer',
963
+ ' that would put it back has stopped looking. Two things about this branch are different in kind from the',
964
+ ' other two: no command reaches it, and it is the one branch of this family with a recovery inside the',
965
+ ' product — both are in half three below.',
966
+ '',
967
+ 'Half one — the DACL ACE did not reach the object:',
968
+ ' The root carries an inheritable ACE for the workspace capability SID — a `S-1-4-…` that `icacls` prints as an',
969
+ ' unresolved SID rather than a name — with Modify or Full control; the failing object does not have it. Check each',
970
+ ' path listed above the same way; the first is shown here.',
863
971
  ' THE TRAP: reading and listing go through the NORMAL token, writing and deleting through the RESTRICTED',
864
972
  ' (low-integrity) one, and both sides must pass. An object whose DACL names only Administrators/SYSTEM plus the',
865
973
  ' capability SID is refused on the read side as well, so it looks granted to a check that only searches for the',
866
974
  ' capability SID — #423 measured exactly that on a `.cache` directory. A check that asks only "is the SID there?"',
867
975
  ' reports those objects as fine while LIST and WRITE are both denied.',
868
- ' A SECOND measured variant has the same shape and a different object: the coverage that is missing can be the',
869
- ' mandatory-integrity LABEL rather than a DACL entry. It was reported in this same thread on 2026-09-29 against a',
870
- ' `0.2.0-rc.1` install, under the same root-only short-circuit. Inside a session the two are indistinguishable;',
871
- ' from outside, the repository\'s own diagnosis skill separates them — `diagnose-windows-sandbox-acl` (0.2.0 and',
872
- ' later) reports `hasExactDeny()` for the DACL half and `LOW_LABEL` (`S-1-16-4096`) for the label half.',
976
+ ' TEST: does the object show the capability ACE at all, inherited or not? Absent → this half, and the object is',
977
+ ' the thing to repair.',
978
+ '',
979
+ 'Half two — the DACL arrived and the LABEL did not (#8383, measured 2026-09-30):',
980
+ ' Measured on a `0.2.0-rc.2` install (Windows 11, 26200 family, NTFS): the workspace root writable, EVERY',
981
+ ' subdirectory denied, and — this is what makes it the label half — the capability ACE present and correctly',
982
+ ' inherited on every one of them. The label, meanwhile, exists on the root alone:',
983
+ ' icacls "<root>" → Mandatory Label\\Low Mandatory Level:(OI)(CI)(NW)',
984
+ ' icacls "<subdir>" → no Mandatory Label line at all',
985
+ ' The decisive form of that measurement is a directory created AFTER the grant was materialized: it inherits the',
986
+ ' capability ACE (marked `(I)`) and still receives no label. That is what rules out "these objects simply predate',
987
+ ' the grant" and isolates the failure to the label layer. One caveat the report itself is careful about and worth',
988
+ ' keeping: a GRANDCHILD directory having no label proves nothing on its own, because inheritance is per-parent and',
989
+ ' the intermediate directory carries none — only a DIRECT child of the labelled root is evidence.',
990
+ ' Why it is permanent: the label goes out in the same single security-descriptor write that carries the grant,',
991
+ ' with the inheritance flag set, but only on the paths the backend enumerates — the workspace root (plus the',
992
+ ' session\'s private temp directory), with no descendant walk. The root-only idempotency check then requires the',
993
+ ' grant, the world delete-child deny AND the exact label (`hasExactGrant()` + `hasExactDeny()` + `hasExactLabel()`',
994
+ ' all matching) before it returns early, so once the root is labelled the propagation is never attempted again and',
995
+ ' the children that missed it are never revisited — the same root-only short-circuit as the DACL half, on the',
996
+ ' other half of the same call (`packages/sandbox/sandbox-windows-acl/src/acl.ts`: the guard at :386-388, the',
997
+ ' label read at :198-204). A second report met this same half afterwards (#8421): the label written on the root',
998
+ ' alone, the pre-existing subdirectories carrying none of it. That is why this branch is stated as a shape this',
999
+ ' backend produces rather than as one machine\'s result.',
1000
+ ' The package README describes that label as inheritable and covering the tree, and its grant materialization as',
1001
+ ' an eager full-tree propagation. Read it as a statement about the ACE that is written, not about what the',
1002
+ ' children ended up carrying: the inheritance flag is declared on the root, the propagation to the children is',
1003
+ ' what is missing. From outside a session the repository\'s own diagnosis skill separates the two halves —',
1004
+ ' `diagnose-windows-sandbox-acl` (0.2.0 and later) prints the directory\'s owner, the caller\'s rights and',
1005
+ ' `WRITE_DAC`/`WRITE_OWNER` — the facts the DACL half turns on — and `LOW_LABEL` (`S-1-16-4096`) for this one.',
1006
+ ' TEST: does a subdirectory show the capability ACE WITHOUT a Mandatory Label line? Yes → this half.',
1007
+ '',
1008
+ 'Half three — the standing grant is gone from the ROOT itself (#8409, reported 2026-09-30):',
1009
+ ' Reported as a control beside two other defects on the same install (Windows 11, NTFS) rather than as a',
1010
+ ' theory: after the workspace root\'s own security descriptor is rewritten from OUTSIDE the harness — an ACL',
1011
+ ' reset, a restored descriptor, a tool that re-applies one — every write inside the workspace is refused, the',
1012
+ ' root\'s own directory included. What is missing is the ACE the harness itself wrote, not a descendant\'s',
1013
+ ' inheritance of it:',
1014
+ ' icacls "<root>" → no ACE for the workspace capability SID in its own DACL',
1015
+ ' The discriminator is what the SAME machine does on the other path, and the reporter measured both: the',
1016
+ ' agentless/runner invocation recovered by itself with no restart, while the desktop session did not. That',
1017
+ ' asymmetry is not one path being more careful — it is where the cache lives. The session-scoped provider',
1018
+ ' materializes the root ACE ONCE PER PROVIDER LIFETIME and keeps that root in its own in-memory map; every later',
1019
+ ' call consults the map and never reads the DACL again, so the exact-ACE check the two halves above turn on is',
1020
+ ' not even reached (`packages/sandbox/sandbox-local/src/index.ts`: the guard at :403-421, "materializes once per',
1021
+ ' workspace per server lifetime" at :359, and the standing edits it skips are called the "cross-session reuse',
1022
+ ' cache" in `packages/sandbox/sandbox-windows-acl/src/grant.ts:22-31`). The runner path used by agentless',
1023
+ ' sessions passes no session id (`windowsAclRunnerArgv()`, :365-380), so the runner owns the DACLs there and',
1024
+ ' re-applies the grant on every spawn — which really does read the DACL, and that is why that path heals and',
1025
+ ' this one does not.',
1026
+ ' RECOVERY: this is the only branch of this family a user can leave behind, and the move is the PROVIDER rather',
1027
+ ' than a command. RESTART IT — quit and reopen the desktop app, or open the workspace in a fresh one. That',
1028
+ ' empties the map, so the next provision reads the DACL, finds the ACE absent and writes it again; the reporter',
1029
+ ' measured exactly that ("restarting the desktop brings it back"). Nothing reachable from inside this session',
1030
+ ' gets there: the map is what is being consulted, and no command you can run here changes what it holds. Do not',
1031
+ ' reach for either repair above either — both are about propagating a grant to DESCENDANTS, and this branch has',
1032
+ ' lost the grant the propagation starts from.',
1033
+ ' TEST: is the workspace ROOT itself denied — no capability ACE in its own DACL? Yes → this branch.',
873
1034
  '',
874
1035
  'Why the natural repair is closed — this is a Windows ceiling, not a mistake in the command:',
875
1036
  ' The grant the root carries is written for a capability SID, and a recursive `icacls /grant "*S-1-4-…:…" /T /C`',
876
1037
  ' is refused with ERROR_NONE_MAPPED (1332): the tool cannot map that SID to a name, so a grant that needs to name',
877
1038
  ' it never reaches the child. Widening the grant to a nameable account is a different grant with different',
878
- ' consequences, not this one restored.',
1039
+ ' consequences, not this one restored. For the label half the same ceiling applies one layer over: re-labelling a',
1040
+ ' subtree is a SACL write, which needs the object right the merged call already needed, and a manually widened',
1041
+ ' DACL does NOT clear the failure — #8383 confirmed that adding an explicit FullControl entry for the user on a',
1042
+ ' subdirectory still left the write denied, because the refusal happens before the ACL is ever consulted.',
1043
+ ' The third branch is not closed by this ceiling and does not need to be: there is nothing to write by hand',
1044
+ ' there — the grant that went missing is the harness\'s own, and all that has to happen is for the layer holding',
1045
+ ' the map to look at the DACL again, which the restart in half three is what makes it do.',
879
1046
  '',
880
1047
  'What helps:',
881
1048
  ' - The move that is yours, and the only one available inside the session: write new files under a directory the',
882
1049
  ' harness itself created in this workspace. Those carry the grant, because their inheritance did apply — the',
883
1050
  ' reporter\'s own measurement, that objects DSH created are complete here and externally created ones are not.',
884
- ' - The user\'s move: repair the specific object from an account that already holds WRITE_DAC on it, by writing',
885
- ' the ACE the root carries into the child\'s own DACL. That needs the very right that is missing, so it is not',
886
- ' something an unelevated prompt can do.',
1051
+ ' Treat this as a workaround and not a repair, and on the LABEL half expect even this to be unreliable: the',
1052
+ ' directories the harness creates in a fresh workspace are children of a root whose label did not propagate, so',
1053
+ ' whether any given one works is a fact about the host you have in front of you rather than something this text',
1054
+ ' can promise.',
1055
+ ' - The user\'s move, per half: for the DACL half, repair the specific object from an account that already holds',
1056
+ ' WRITE_DAC on it, by writing the ACE the root carries into the child\'s own DACL. For the label half, the',
1057
+ ' corresponding move is on the integrity label rather than the DACL, and it has to cover the tree, not one',
1058
+ ' object; it is the same class of object write, so it is not something an unelevated prompt can do either.',
1059
+ ' For the third branch there is no object to repair at all: the move is the restart named in half three.',
1060
+ ' - The route that costs no rights at all, and the honest recommendation while the halves remain unrepairable from',
1061
+ ' inside: build and run where the confinement is not the thing under test — which is a decision about what you',
1062
+ ' are doing, not a sandbox tier to reach for silently.',
887
1063
  ' No repair command is printed here on purpose. This project has no Windows host to verify one on, and shipping',
888
1064
  ' an unverified line would be the same defect this plugin exists to answer. The mechanism above is what is known;',
889
1065
  ' the line is yours to choose.',
@@ -892,8 +1068,9 @@ function workspaceDenialAdvisory(failure, tool, href) {
892
1068
  'mode. That retry can only succeed by removing the confinement itself — it repairs nothing in the workspace, and',
893
1069
  'the next session meets the same gap. Take it only if that is what you mean to buy.',
894
1070
  '',
895
- 'Do NOT retry this call unchanged: the provisioning path short-circuits on the root grant, so the object that was',
896
- 'skipped is never revisited.',
1071
+ 'Do NOT retry this call unchanged: the provisioning path short-circuits on the root — on the grant AND on the',
1072
+ 'label — so the object that missed the propagation is never revisited; and in the third branch the layer still',
1073
+ 'being consulted is the provider\'s own map, which nothing inside this session can change.',
897
1074
  '',
898
1075
  'How to read this: the denial names no cause and points at no repair, so the diagnosis is delivered here instead.',
899
1076
  'This is a stopgap, ' + where + '. This plugin speaks only when the mode is `workspace-write`, the host is',
@@ -132,11 +132,16 @@
132
132
  * normal token while writing and deleting use the restricted one, so an object
133
133
  * whose DACL names only `Administrators`/`SYSTEM` plus the capability SID is
134
134
  * refused on the read side too and looks granted to a grep for the SID
135
- * (#423 measured it). The variant that would otherwise be missed gets its own
136
- * sentence as well — the same shape with the missing coverage on the mandatory
137
- * label instead of the DACL (reported 2026-09-29 in the same thread), which is
138
- * indistinguishable from inside a session and separable by the repository's own
139
- * diagnosis skill.
135
+ * (#423 measured it). And the second branch is now **first-class rather than a
136
+ * sentence**: the same root-only short-circuit on the *label* half, where the
137
+ * DACL reaches every object and the mandatory-integrity label reaches none of
138
+ * the subdirectories, so nothing below the root is writable at all (`#8383`,
139
+ * measured against `0.2.0-rc.2` with the decisive control of a directory
140
+ * created *after* the grant). The two branches are indistinguishable from
141
+ * inside a session and permanent for the same reason, so the text forks them
142
+ * on **breadth** — the one fact the reader already owns — before it hands over
143
+ * any check, and separates them from outside by the repository's own
144
+ * `diagnose-windows-sandbox-acl` and its `LOW_LABEL` report.
140
145
  *
141
146
  * Both give a **discriminator, not just a remedy**: applying a fix without
142
147
  * confirming the cause teaches nothing when the fix does not work. For the ACL
@@ -156,7 +161,10 @@
156
161
  * against: the reader can audit the plugin's own reasoning instead of taking a
157
162
  * claim about two strings on faith. That family's check is also the one place
158
163
  * where a single fact is not enough — reachability has two sides, and the text
159
- * says which one a check on the ACE alone would miss.
164
+ * says which one a check on the ACE alone would miss — and it is the one family
165
+ * with a **second cut before the check**: which half is missing is settled by how
166
+ * MUCH of the tree is affected, because a reader who repairs the DACL of a
167
+ * label-starved workspace has spent a privilege for nothing.
160
168
  *
161
169
  * @module
162
170
  */
@@ -166,12 +174,19 @@ import type { SandboxModeName } from './mode.js';
166
174
  * The upstream threads the ACL advisory is a stopgap for.
167
175
  *
168
176
  * The first twelve report the provisioning failure itself (the merged DACL +
169
- * label write being refused). The last two, `#8312` and `#8314`, report the
170
- * other end of the same backend — what its grant leaves behind once it
171
- * *succeeds* — which the advisory states because it is the fact a reader needs
172
- * at the moment it hands them the command that applies that grant.
177
+ * label write being refused). `#8312` and `#8314` report the other end of the
178
+ * same backend — what its grant leaves behind once it *succeeds* — which the
179
+ * advisory states because it is the fact a reader needs at the moment it hands
180
+ * them the command that applies that grant. The last three arrived later and
181
+ * are all inside the same advisory: `#8426` is the independent, unelevated
182
+ * measurement of the missing `WRITE_OWNER` the diagnosis above had only ever
183
+ * argued for, and `#8412` is a second instance of what the grant leaves behind
184
+ * (the standing Low label reaching programs the user launches themselves).
185
+ * `#8409` is the same backend once more and belongs to both lists: one of its
186
+ * three defects is the provisioning failure this family explains, and another
187
+ * is the fourth family's third branch.
173
188
  */
174
- export declare const ACL_DISCUSSIONS = "#7538 / #7622 / #7646 / #7720 / #7750 / #7735 / #7771 / #7804 / #7816 / #8232 / #8272 / #8275 / #8312 / #8314";
189
+ export declare const ACL_DISCUSSIONS = "#7538 / #7622 / #7646 / #7720 / #7750 / #7735 / #7771 / #7804 / #7816 / #8232 / #8272 / #8275 / #8312 / #8314 / #8426 / #8412 / #8409";
175
190
  /**
176
191
  * The upstream threads the persistent-shell advisory is a stopgap for.
177
192
  *
@@ -192,15 +207,21 @@ export declare const PTY_DISCUSSIONS = "#7638 / #8322";
192
207
  */
193
208
  export declare const NATIVE_INIT_DISCUSSIONS = "#7876 / #7877 / #8193 / #8208 / #8313 / #8336 / #8334";
194
209
  /**
195
- * The upstream thread the workspace-denial advisory is a stopgap for.
210
+ * The upstream threads the workspace-denial advisory is a stopgap for.
196
211
  *
197
- * One thread, because this family is one report and its own follow-up: `#423`
198
- * is the failure and its measurements (170 of 729 objects missing the grant,
199
- * root-level files among them, and the two-sided reachability rule), and the
200
- * second comment in that thread is the mandatory-label variant of the same
201
- * shape.
212
+ * `#423` is the failure and its first measurements: 170 of 729 objects missing
213
+ * the grant, root-level files among them, and the two-sided reachability rule.
214
+ * Its second comment named the mandatory-label variant of the same shape, which
215
+ * `#8383` then measured on its own — the exact complement, with the DACL
216
+ * present and inheriting correctly at every level while the label reaches none
217
+ * of the subdirectories, so the variant stopped being a footnote and became the
218
+ * second branch the discriminator forks into; `#8421` met it again, which is
219
+ * why the branch reads as a shape rather than as one install. `#8409` is the
220
+ * third branch's source and a report of the DACL half as well: the workspace
221
+ * root's own standing grant can be gone, and the layer that would re-apply it
222
+ * consults a per-lifetime map instead of the DACL, so nothing notices.
202
223
  */
203
- export declare const WORKSPACE_DENIAL_DISCUSSIONS = "#423";
224
+ export declare const WORKSPACE_DENIAL_DISCUSSIONS = "#423 / #8383 / #8421 / #8409";
204
225
  /**
205
226
  * The thread list each family's withholding note cites.
206
227
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@argszero/cordis-plugin-sandbox-grant-advisor",
3
- "description": "Turns four sandbox environment failures that name neither their cause nor a remedy into a diagnosis with a path forward. Family 1, the Windows workspace ACL: twelve reports (#7538, #7622, #7646, #7720, #7750, #7735, #7771, #7804, #7816, #8232, #8272, #8275) of one signature — 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. Two further reports (#8312, #8314) describe the other end of that same backend — what its grant leaves behind once it succeeds: three STANDING entries nothing revokes (the workspace capability SID, the world delete-child deny, and an INHERITABLE Low integrity label that lives in the SACL, so resetting the DACL does not take it off), which makes every program launched from a folder DSH has written to run at Low integrity, and — through the NTFS hard links a pnpm workspace is made of, where two names share one file object and therefore one security descriptor — can reach out of the tree onto a content-addressed store's shared objects, leaving every project that builds from that store with Low-integrity executables and failures that name the build tool rather than DSH; the advisory states all of it before handing over the command that applies that grant, and offers no removal command, because the maintainers' own diagnosis skill does not remove the label either and removing one needs WRITE_OWNER. Family 2, the persistent shell (#7638, #8322): 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; #8322 separated the arms inside that mode with one runner and one ConPTY — a console-subsystem node.exe host starts the confined shell while the packaged desktop's GUI-subsystem Electron host kills it silently — so the advisory names the host alongside the mode, says the outcome is deterministic per (session mode × host) rather than intermittent, and adds the console-owning host the Web UI provides (#8313) to the user-side options. 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 — 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 — 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) — 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 four 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; the two value-read families advised only when the facts they need hold \u2014 a confining resolved mode for the native-init death, and a Windows host, a `workspace-write` stamped mode and an in-workspace path for the denial), 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 second boundary the later reports needed (the backend's own `diagnose-windows-sandbox-acl` skill is not part of the 0.1.7 line at all — it arrives with 0.2.0, measured on both published tarballs: 0.1.7-rc.2 names it zero times in either README, ships no assets, and carries no registration symbol anywhere in its tree, while 0.2.0-rc.2 ships assets/diagnose-windows-sandbox-acl/ and names it three times per README — so a reader who found the promise in a README was reading a 0.2.0-era document, and sending them to repair a files glob would be the wrong repair), and why a \"weaker grant\" is a mechanism the backend cannot express rather than a policy it declines (the label rides the SAME SetNamedSecurityInfoW as the grant — there is no DACL-only apply path to fall back to — and the confined token is itself lowered to Low, so the object's Low label is what lets the confined child write there at all; declining the label usefully means declining the token level with it), 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 — the owner's implicit WRITE_DAC already covers the DACL half — 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% — and the two remedies that look right and are not (`takeown`, `icacls /reset`), each with the reason it fails — and it states the two things about the failure's shape that the reports had to measure for themselves (#8232): that it belongs to the workspace rather than to the command (a command that only reads fails identically, so there is no harmless retry), and that the grant is scoped to the directory it names and its children, so a sibling workspace root on the same volume needs the line once more; the PTY advisory names the failing combination and the host binary that decides it, states the resolved mode and that the session's recorded mode is the one that counts, tells the model to stop rather than retry, and hands over the user-side options (a preset swap, a patch row, or the console-owning host of #8313) — 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 — naming both measured shapes of the desktop host rather than asserting the one that was measured first — 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 — for the Electron host — 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 — it never claims the sandbox caused the failure and never offers a widened mode as a fix. It also states the single rule the whole family follows from, because a reader without it reaches for the wrong flag: in a restricted token a console can be INHERITED but not CREATED, so a creation flag that forces the child to make one of its own (`CREATE_NO_WINDOW`, `CREATE_NEW_CONSOLE`) is fatal on its own, while `DETACHED_PROCESS` — which declines a console rather than creating one — is not; #8336 measured that matrix on one machine, including the pair that makes it a rule rather than a list (the same flag on an UNRESTRICTED token is harmless, as is `STARTF_USESHOWWINDOW` with `SW_HIDE`), and the advisory answers the `windowsHide` suspicion instead of ignoring it: that flag is not set anywhere on the confined path — it appears on the ORDINARY subprocess path (`dsh-subprocess-local`'s spawn, which starts the runner rather than the confined child), and the restricted spawn defines no `CREATE_NO_WINDOW` constant at all — and where it IS set, #8208 measured it both ways on a host that works, because a windowless console is still a console: what decides is whether the host owns a console OBJECT, not whether it owns a window (#8336, #8334). Family 4, a confined command DENIED a path inside its own workspace (#423): the workspace grant is applied once, on the root, and relies on Windows ACE inheritance to reach the tree beneath it, so an object that already existed (created by an installer, an editor, another harness under its own account) whose DACL the caller could not write kept its older DACL — silently, because a skipped inherited ACE produces no error, no return value and no log line — after which the backend's root-only check (`hasExactGrant(workspaceRoot)`) short-circuits and those descendants are NEVER revisited, so the identical command keeps failing while a directory the harness itself created works; the family is read from the executors' own structured stamp on a successful result (`sandbox: { mode, denied, enforcement? }`, produced by matching the backend's refusal dialect in the captured stderr, so what it reads is the harness's own reading of its own sandbox), and it speaks only when the host is Windows, the stamped mode is `workspace-write`, and EVERY absolute path the command's own arguments name lies under the session's workspace — a denial anywhere else is the designed escalation path, and a command naming any outside path as well, or only relative ones, is refused rather than guessed at because the plugin cannot say which path was refused; the advisory prints the path it keyed on beside the root it tested it against, states that retrying is provably useless, gives the two-sided discriminator (reading and listing use the normal token while writing and deleting use the restricted one, so an object whose DACL names only Administrators/SYSTEM plus the capability SID looks granted to a check that merely greps for the SID), names the second measured variant of the same shape (coverage missing on the mandatory-integrity LABEL rather than on the DACL, separable outside a session only by the repository's own `diagnose-windows-sandbox-acl`), and states the Windows ceiling that closes the obvious repair (a recursive `icacls /grant` for a capability SID is refused with ERROR_NONE_MAPPED (1332) because that SID has no name to map) — while shipping NO repair command at all, for the reason the standing-grant section ships none: this project has no Windows host to verify a line on. 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.12.0",
3
+ "description": "Turns four sandbox environment failures that name neither their cause nor a remedy into a diagnosis with a path forward. Family 1, the Windows workspace ACL: twelve reports (#7538, #7622, #7646, #7720, #7750, #7735, #7771, #7804, #7816, #8232, #8272, #8275) of one signature — 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. Two further reports (#8312, #8314) and a third (#8412) describe the other end of that same backend — what its grant leaves behind once it succeeds: three STANDING entries nothing revokes (the workspace capability SID, the world delete-child deny, and an INHERITABLE Low integrity label that lives in the SACL, so resetting the DACL does not take it off), which makes every program launched from a folder DSH has written to run at Low integrity, and — through the NTFS hard links a pnpm workspace is made of, where two names share one file object and therefore one security descriptor — can reach out of the tree onto a content-addressed store's shared objects, leaving every project that builds from that store with Low-integrity executables and failures that name the build tool rather than DSH; the advisory states all of it before handing over the command that applies that grant, and offers no removal command, because the maintainers' own diagnosis skill does not remove the label either and removing one needs WRITE_OWNER. Family 2, the persistent shell (#7638, #8322): 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; #8322 separated the arms inside that mode with one runner and one ConPTY — a console-subsystem node.exe host starts the confined shell while the packaged desktop's GUI-subsystem Electron host kills it silently — so the advisory names the host alongside the mode, says the outcome is deterministic per (session mode × host) rather than intermittent, and adds the console-owning host the Web UI provides (#8313) to the user-side options. 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 — 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 — 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) — 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 four 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; the two value-read families advised only when the facts they need hold \u2014 a confining resolved mode for the native-init death, and a Windows host, a `workspace-write` stamped mode and an in-workspace path for the denial), 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 second boundary the later reports needed (the backend's own `diagnose-windows-sandbox-acl` skill is not part of the 0.1.7 line at all — it arrives with 0.2.0, measured on both published tarballs: 0.1.7-rc.2 names it zero times in either README, ships no assets, and carries no registration symbol anywhere in its tree, while 0.2.0-rc.2 ships assets/diagnose-windows-sandbox-acl/ and names it three times per README — so a reader who found the promise in a README was reading a 0.2.0-era document, and sending them to repair a files glob would be the wrong repair), and why a \"weaker grant\" is a mechanism the backend cannot express rather than a policy it declines (the label rides the SAME SetNamedSecurityInfoW as the grant — there is no DACL-only apply path to fall back to — and the confined token is itself lowered to Low, so the object's Low label is what lets the confined child write there at all; declining the label usefully means declining the token level with it), 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 — the owner's implicit WRITE_DAC already covers the DACL half — 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% — and the two remedies that look right and are not (`takeown`, `icacls /reset`), each with the reason it fails, and it states that independent measurement of the missing right (#8426): `icacls <dir> /setintegritylevel \"(OI)(CI)Low\"` is refused unelevated, and the identical command succeeds the moment that account grants itself `(OI)(CI)F` (whose mask carries WRITE_OWNER), which is the right demonstrated from outside this project's reading and shown to be a right on the directory rather than SeRelabelPrivilege or elevation — the same report repairing two trees object-right-first and label-second (9521 and 5592 objects, no failures), the order the advisory's own remedy already follows — and it states the two things about the failure's shape that the reports had to measure for themselves (#8232): that it belongs to the workspace rather than to the command (a command that only reads fails identically, so there is no harmless retry), and that the grant is scoped to the directory it names and its children, so a sibling workspace root on the same volume needs the line once more; the PTY advisory names the failing combination and the host binary that decides it, states the resolved mode and that the session's recorded mode is the one that counts, tells the model to stop rather than retry, and hands over the user-side options (a preset swap, a patch row, or the console-owning host of #8313) — 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 — naming both measured shapes of the desktop host rather than asserting the one that was measured first — 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 — for the Electron host — 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 — it never claims the sandbox caused the failure and never offers a widened mode as a fix. It also states the single rule the whole family follows from, because a reader without it reaches for the wrong flag: in a restricted token a console can be INHERITED but not CREATED, so a creation flag that forces the child to make one of its own (`CREATE_NO_WINDOW`, `CREATE_NEW_CONSOLE`) is fatal on its own, while `DETACHED_PROCESS` — which declines a console rather than creating one — is not; #8336 measured that matrix on one machine, including the pair that makes it a rule rather than a list (the same flag on an UNRESTRICTED token is harmless, as is `STARTF_USESHOWWINDOW` with `SW_HIDE`), and the advisory answers the `windowsHide` suspicion instead of ignoring it: that flag is not set anywhere on the confined path — it appears on the ORDINARY subprocess path (`dsh-subprocess-local`'s spawn, which starts the runner rather than the confined child), and the restricted spawn defines no `CREATE_NO_WINDOW` constant at all — and where it IS set, #8208 measured it both ways on a host that works, because a windowless console is still a console: what decides is whether the host owns a console OBJECT, not whether it owns a window (#8336, #8334). Family 4, a confined command DENIED a path inside its own workspace (#423, #8383, #8421, #8409): the workspace grant is applied once, on the root, and relies on Windows ACE inheritance to reach the tree beneath it, so an object that already existed (created by an installer, an editor, another harness under its own account) whose DACL the caller could not write kept its older DACL — silently, because a skipped inherited ACE produces no error, no return value and no log line — after which the backend's root-only check (`hasExactGrant(workspaceRoot)`) short-circuits and those descendants are NEVER revisited, so the identical command keeps failing while a directory the harness itself created works; the family is read from the executors' own structured stamp on a successful result (`sandbox: { mode, denied, enforcement? }`, produced by matching the backend's refusal dialect in the captured stderr, so what it reads is the harness's own reading of its own sandbox), and it speaks only when the host is Windows, the stamped mode is `workspace-write`, and EVERY absolute path the command's own arguments name lies under the session's workspace — a denial anywhere else is the designed escalation path, and a command naming any outside path as well, or only relative ones, is refused rather than guessed at because the plugin cannot say which path was refused; the advisory prints the path it keyed on beside the root it tested it against, states that retrying is provably useless, gives the two-sided discriminator (reading and listing use the normal token while writing and deleting use the restricted one, so an object whose DACL names only Administrators/SYSTEM plus the capability SID looks granted to a check that merely greps for the SID), names the second branch the same shape forks into — the mandatory-integrity LABEL reaching none of the subdirectories while the DACL arrives at every level (#8383, second instance #8421, measured on 0.2.0-rc.2 with the decisive control of a directory created after the grant) — and names the third: the workspace ROOT itself refused, the standing grant gone from its own DACL and the provider's per-lifetime map the only layer still consulted, which never re-reads the DACL while the agentless runner path (no session id) re-applies the grant on every spawn and therefore heals (#8409) — and forks the three on BREADTH before any check, because from inside a session the first two are indistinguishable and a reader who repairs the wrong half has learned nothing; it gives each branch its own TEST, states that the propagation halves are permanent for the same root-only short-circuit (grant + world delete-child deny + exact label must all match before the backend returns early, on the same single security-descriptor write) and that the third is the one branch with a recovery inside the product — a user restart of the provider, which empties the map and lets the next provision rewrite the missing ACE — separates the first two from outside a session by the repository's own `diagnose-windows-sandbox-acl` (owner rights and `WRITE_OWNER` for one half, `LOW_LABEL` for the other), and states the Windows ceiling that closes the obvious repair (a recursive `icacls /grant` for a capability SID is refused with ERROR_NONE_MAPPED (1332) because that SID has no name to map; a widened DACL does not clear the label half either, because the refusal precedes the ACL — and the third branch needs no hand-written ACE at all) — while shipping NO repair command at all, for the reason the standing-grant section ships none: this project has no Windows host to verify a line on. 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.14.0",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/types/index.d.ts",