Repository navigation
Release 0.8.0
Cordon 0.8.0
Cordon is a Crystal shard that runs shell commands inside a platform-native sandbox with a configurable access policy. It works on macOS (via sandbox-exec / Seatbelt), Linux (via bwrap / Bubblewrap) and, as a preview, Windows 11 (via Microsoft's MXC wxc-exec.exe), presenting all three as a single clean API.
Changes
Cordon.spawn- Starts a command inside the cordon and yields the running process to a block, for commands that talk to their caller while they run, such as language servers, REPLs and workers driven over stdin and stdout (#45). The redirects (input: :pipeand so on) go toProcess.newunchanged. When the block ends, however it ends, the process is killed if still running and waited for, the launcher's files are deleted, and any exception from the block is re-raised. Callingprocess.waitinside the block is safe.- Linux: sandboxes die with their caller -
runandspawnnow pass--die-with-parentto bwrap, so killing the calling process ends the sandboxed command instead of leaving it orphaned.Cordon.relaunchis unchanged. - Runner implementers:
launchreplacesrun- ARunnersubclass now implements the protectedlaunch, returning the argv and any files to delete;runandspawnare built on it in the base class. Code that only calls Cordon is unaffected.
Known issues
- macOS: killing a spawned command ends that process only; processes it started keep running, still sandboxed, and can hold the caller's pipes open. Linux and Windows end the whole process tree (#NN).
Policy#envandPolicy#unset_envare honoured on Linux and Windows but silently ignored by the macOS runner, which inherits the parent environment instead. See #24.- Windows: MXC 1.0.0 no longer carries the "early preview, not a security boundary" warning of earlier releases, but PSEC is new and may change between Windows updates. Cordon pins the MXC version it is tested against; re-run
cordon confirmafter Windows updates (#41). - Windows: a batch file (
.bat,.cmd) can only be run withshell: true, because its arguments cannot be quoted safely. - Windows: tested on Windows 11 Enterprise 25H2, on ARM (a VM and GitHub's Windows 11 ARM runner, with
cordon.exeunder x64 emulation) and on an x64 laptop, wherecordon.exeruns natively. Other editions such as Windows 11 Pro are not yet tested. - Windows: the process security environment arrives with recent Windows 11 25H2 updates. A laptop on build 26200.8893 lacked it and gained it on 26200.9448; if
check-windows.ps1reports it unavailable, install the latest updates and check again. - Windows: only an x64
cordon.exeis built; ARM machines run it under emulation (#39). - Windows:
cordon.exeis unsigned, and some endpoint security products flag the statically linked executable as suspicious (#40). - Windows: everything under
C:\Windowsis readable and executable in the sandbox without a grant (#38). - Windows: PowerShell 7, Git Bash, toolchains installed per user, and junctions or symlinks inside granted paths are not yet validated (#34, #35, #36).
For architecture, design decisions, and debugging workflows see DEVELOPMENT.md.