Replies: 1 comment
|
Thank you — this is a careful report, and the source observations in §5 check out against
Where the permanence comes from — the part the measurements could only infer. What I cannot settle from here. Whether the cause is the Which half a reader is looking at — both halves produce this identical denial:
Only a direct child of the labelled root is evidence for the second: a grandchild having no label proves nothing, because inheritance is per-parent and the intermediate directory carries none. Your §3.3 control is exactly the direct-child form, which is what makes it decisive. A stopgap for the shape, if not for the cause. Your reproduction is a denied write inside the workspace, and the executors' denial dialect for this backend includes - insert:
- id: sandbox-grant-advisor
name: '@argszero/cordis-plugin-sandbox-grant-advisor' |
Uh oh!
There was an error while loading. Please reload this page.
Windows
workspace-writesandbox: workspace subdirectories are unwritable (Low mandatory label is not applied to / inherited by children)Package:
@deepseek-ai/dsh-sandbox-windows-acl@0.2.0-rc.2Platform: Windows 11 (build 26200 family), NTFS
Severity: High — under
workspace-writethe workspace is effectively unusable: only files directly under the workspace root can be written; every subdirectory is denied.Class: Behavior contradicts the package README / missing mandatory-integrity-label coverage
1. Summary
Under
workspace-write, a confined child process (Low integrity) cannot write to any subdirectory of the workspace, while writing to the workspace root itself works normally.The DACL is not the cause: the capability SID's write grant is present and correctly inherited at every level. The problem is that the mandatory integrity label is applied only to the workspace root and never reaches the subdirectories — not even a subdirectory created after the grant was materialized. Those directories therefore keep the system-default Medium integrity level, and the kernel's mandatory-integrity check (no-write-up) denies a Low-integrity process write access to a Medium object. This happens independently of, and before, the DACL check, so the seemingly correct write grant in the DACL is never exercised.
The package README describes this label as the workspace's "inheritable label" and describes grant materialization as an "eager full-tree propagation". The observed behavior contradicts both statements.
2. Minimal reproduction (user's perspective, no source reading required)
workspace-write(the default mode).C:\workspace\output.Actual result:
The root is writable; subdirectories are not. The same denial reproduces identically at the .NET layer (
[System.IO.File]::WriteAllTextis denied the same way), so this is not a PowerShell-level artifact. Switching the policy to full access immediately restores every write, confirming the denial comes from the restricted-token path rather than from the directory's own permissions.3. Evidence
3.1 The confined child runs at Low integrity
3.2 The mandatory integrity label exists only on the workspace root
The label carries
(OI)(CI)(object inherit + container inherit) and should therefore cover the whole subtree; in practice it exists only on the root.3.3 Decisive control: a freshly created child inherits the DACL grant but not the label
Creating a brand-new subdirectory after the grant has been materialized isolates the two mechanisms cleanly:
The freshly created child does inherit the capability ACE from the workspace root's DACL (marked
(I)), so DACL inheritance works. It does not receive the Low integrity label, even though that label is also configured(OI)(CI)on the root. Both inheritable entries are declared on the same object in the same apply call, yet only one propagates.This rules out "the child simply predates the grant" and isolates the failure to the label layer.
3.4 The DACL side is entirely correct (proof that this is not an ACL problem)
The capability SID's grant is present on every subdirectory, with correct inheritance:
A full-tree scan found no anomalous write-class deny entries anywhere. Judged purely by the DACL, these directories should all be writable; the write is refused by the integrity check, not by the access control list.
4. Contradiction with the documentation
Three statements in the package's own
README.mdconflict directly with the measurements:(a) README:129 — describes the label as inheritable and covering the tree:
(b) README:187 — describes grant materialization as propagating to all descendants:
(c) README:102 — and explicitly states that only labeled directories remain writable:
Taken together, (a)–(c) imply that subdirectories must carry the label and are therefore writable. Measurement 3.2/3.3 shows they carry no label, so (a) and (b) do not hold as written.
The package's own diagnosis script independently reports the same contrast when inspecting the workspace root versus a subdirectory (
LOW_LABEL=Truefor the root, empty forscripts), corroborating theicaclsevidence.5. Relevant source locations
File:
lib/types-*.js(locallylib/types-Cl_DXjhk.js); line numbers for 0.2.0-rc.2.buildLowLabelAcladdMandatoryAce(acl, 2, 3, 1, lowLabelSidPtr)with inheritance flag3=OI|CI(matching the(OI)(CI)observed on the root)hasExactLabelgrantWritemergeAndApply(... labelEdit ...))buildExplicitAccessgrantWritedoes not pass them explicitly, so it takes the defaultrestrictTokenIntegritySetTokenInformation(TokenIntegrityLevel)); its comment states a token left at Medium would ignore these labelsrestrictTokenIntegrity(api, restrictedToken, lowLabelSid)for (const path of this.writableDirs) grantWrite(...)writableDirswritableDirs: parsed.mode === "workspace-write" ? [parsed.workspace] : []writableDirscontains only the workspace rootInferred cause (offered for maintainers, not verified layer by layer):
grantWriteruns only against the workspace root. Although the label ACE carriesOI|CI, on this host it does not reach the subdirectories — not even one created after the grant — while the DACL capability ACE from the same apply call does inherit normally. The kernel evaluates its mandatory-integrity check against each object's own effective label, so an unlabeled subdirectory counts as system-default Medium and the Low child is denied by no-write-up. The likely explanation is that the inheritable flag on the mandatory-label entry is not honoured the way the DACL-side inheritance is; maintainers can tell whether that is a flag issue inaddMandatoryAce, a property of applying the label throughSetNamedSecurityInfoW, or host-specific.Worth noting: the failure is independent of the DACL, so ACL-oriented diagnosis and repair cannot help. Confirmed empirically — manually adding an explicit
FullControlgrant for the current user on a subdirectory still left writes denied.6. Impact
workspace-write, no subdirectory is writable, so the agent cannot produce files in the usual places (output/,scripts/,src/, …). The default sandbox mode is effectively unusable for real projects.Access to the path ... is denied, which does not point at the integrity level. It is very easily misdiagnosed as a file-permission problem, which costs substantial debugging time (as it did here).7. Suggested directions
OI|CIinheritance does not materialize on children while the capability ACE's does, and make the label reach the subtree by whatever mechanism reliably works.8. Reproduction material
A read-only script that prints each directory's mandatory integrity label via
icaclsis available on request.All reactions