Skip to content

Release 0.8.0

Choose a tag to compare

@nogginly nogginly released this 12 Oct 02:33
· 7 commits to main since this release
Immutable release. Only release title and notes can be modified.
e2f7819

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: :pipe and so on) go to Process.new unchanged. 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. Calling process.wait inside the block is safe.
  • Linux: sandboxes die with their caller - run and spawn now pass --die-with-parent to bwrap, so killing the calling process ends the sandboxed command instead of leaving it orphaned. Cordon.relaunch is unchanged.
  • Runner implementers: launch replaces run - A Runner subclass now implements the protected launch, returning the argv and any files to delete; run and spawn are 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#env and Policy#unset_env are 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 confirm after Windows updates (#41).
  • Windows: a batch file (.bat, .cmd) can only be run with shell: 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.exe under x64 emulation) and on an x64 laptop, where cordon.exe runs 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.ps1 reports it unavailable, install the latest updates and check again.
  • Windows: only an x64 cordon.exe is built; ARM machines run it under emulation (#39).
  • Windows: cordon.exe is unsigned, and some endpoint security products flag the statically linked executable as suspicious (#40).
  • Windows: everything under C:\Windows is 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.