fix(agent): a read-only folder stays read-only to the AppContainer when it inherits a low label #64
No reviewers
Labels
No labels
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
priority
critical
priority
high
priority
low
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Beanstalk!64
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Beanstalk:fix/readonly-medium-label"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
In Longshot #1118 (Unity's PC: Windows 10.0.26200, Intel UHD, nightly-110), the AppContainer check failed
write_granted: the sandbox wrote a file in the folder it was only given to read. So that PC has no sandbox and gets no jobs. Everything else in AppContainer mode passed.An AppContainer runs at low integrity. A folder without a label is medium, and Windows' no-write-up rule keeps a low-integrity process from writing it, whatever its ACL says. So the sandbox could write there only because the folder carried a low label, inherited from a folder above, together with permissions that let it write.
The agent gives each read grant its ACE (read and execute) but never a label, so an inherited low label stood. A writable grant gets an explicit low label, on purpose. The granted folder is new on every check, so it can only have got the label by inheriting it.
What changed
WinAcl.KeepReadOnly, for the AppContainer sandbox's read grants:WinGrants.LowLabelled), it gets an explicit medium no-write-up label:S:(ML;OICI;NW;;;ME)for a folder,S:(ML;;NW;;;ME)for a file. The sandbox can't write there, whatever the permissions allow.Testing
LowLabelled: an inherited low label, one by SID, any case, none or medium ones.dotnet build agent/App -c Release: 0 warnings.sandbox-checkon the next nightly should passwrite_granted. If it still fails, itswrite_granted_whyline (#63) shows the drive's file system and the permissions; on a FAT32 or exFAT drive, nothing can keep a folder read-only.