fix(agent): the Windows sandbox check says why a read-only folder was writable #63

Merged
HumanBean merged 1 commit from HumanBean/Beanstalk:fix/sandbox-check-why into main 2026-11-16 11:54:32 +00:00
Owner

Why

In Longshot #1118, a tester's beanstalk-agent sandbox-check (Windows 10.0.26200, Intel UHD, nightly-110) failed write_granted: the sandbox wrote a file in the folder it was only given to read. The check failed closed, as it should, so that PC has no sandbox and the farm sends it no jobs. But the report can't say why, and everything else in AppContainer mode passed.

The agent sets only its own explicit permission entries (ACEs). If the folder inherits one from a parent folder that lets the sandbox write, or the drive keeps no permissions at all (FAT32, exFAT), the folder isn't read-only for the sandbox.

What changed

When write_granted fails, the check adds INFO write_granted_why:

  • The drive's file system. On anything but NTFS or ReFS it says plainly that the drive keeps no permissions, so the sandbox can write anything on it, and asks the tester to choose a data folder on an NTFS drive.
  • The permissions and integrity labels of the granted folder, its parent and the data folder, as SDDL (WinAcl.Sddl). This PC's account ids are cut (WinPipes.MaskSids) and the sandbox's SID is shown as <sandbox>. That shows which entry, inherited from where, lets it write.

It's information only; what the farm requires doesn't change. The pipe lines in that report are expected: the plain pipe names can't be made in the sandbox, and the local name, which Longshot uses, works.

Testing

  • Agent checks: 1872 passed, with new ones for the file-system note. dotnet build agent/App -c Release: 0 warnings.
  • Not run on Windows. The tester's next sandbox-check on a nightly with this gives the explanation.
## Why In [Longshot #1118](https://git.magicbean.dev/MagicBeanDev/Longshot/issues/1118), a tester's `beanstalk-agent sandbox-check` (Windows 10.0.26200, Intel UHD, nightly-110) failed `write_granted`: the sandbox wrote a file in the folder it was only given to read. The check failed closed, as it should, so that PC has no sandbox and the farm sends it no jobs. But the report can't say why, and everything else in AppContainer mode passed. The agent sets only its own explicit permission entries (ACEs). If the folder inherits one from a parent folder that lets the sandbox write, or the drive keeps no permissions at all (FAT32, exFAT), the folder isn't read-only for the sandbox. ## What changed When `write_granted` fails, the check adds `INFO write_granted_why`: - **The drive's file system.** On anything but NTFS or ReFS it says plainly that the drive keeps no permissions, so the sandbox can write anything on it, and asks the tester to choose a data folder on an NTFS drive. - **The permissions and integrity labels** of the granted folder, its parent and the data folder, as SDDL (`WinAcl.Sddl`). This PC's account ids are cut (`WinPipes.MaskSids`) and the sandbox's SID is shown as `<sandbox>`. That shows which entry, inherited from where, lets it write. It's information only; what the farm requires doesn't change. The pipe lines in that report are expected: the plain pipe names can't be made in the sandbox, and the local name, which Longshot uses, works. ## Testing - Agent checks: 1872 passed, with new ones for the file-system note. `dotnet build agent/App -c Release`: 0 warnings. - Not run on Windows. The tester's next `sandbox-check` on a nightly with this gives the explanation.
fix(agent): the Windows sandbox check says why a read-only folder was writable
Some checks failed
CI / Conventional Commit title (pull_request) Successful in 4s
CI / Workflow lint (actionlint) (pull_request) Successful in 4s
CI / Coordinator tests (pull_request) Has been cancelled
CI / Agent build and checks (pull_request) Has been cancelled
CI / Coordinator image (pull_request) Has been cancelled
105ea841f1
Longshot #1118: on one tester's PC the AppContainer check wrote a file in
the folder it was only given to read, so the PC got no sandbox (correctly:
the farm sends it no jobs), but the report could not say why. When
write_granted fails the check now adds write_granted_why: the drive's file
system (FAT32 and exFAT keep no permissions: the tester is told to choose a
data folder on an NTFS drive) and the permissions and integrity labels of
the folder, its parent and the data folder as SDDL, with this PC's account
ids cut and the sandbox's SID named <sandbox>.

Assisted-by: Claude Opus 5.5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean deleted branch fix/sandbox-check-why 2026-11-16 11:54:32 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Beanstalk!63
No description provided.