Skip to content

Release 0.7.0

Choose a tag to compare

@nogginly nogginly released this 29 Sep 04:33
· 9 commits to main since this release
Immutable release. Only release title and notes can be modified.
d8754aa

Cordon 0.7.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, new in this release as a preview, Windows 11 (via Microsoft's MXC wxc-exec.exe), presenting all three as a single clean API.

Changes

  • Windows 11 support (preview) - A new runner, Cordon::Mxc, sandboxes commands with Windows' process security environment (PSEC) through Microsoft's MXC tool. Cordon.run selects it automatically on Windows.
    • The policy is attached to the process itself, as on macOS and Linux: no host ACLs are changed, no extra user accounts are created, and no administrator rights are needed to run a command. MXC's ACL-based fallback is deliberately disabled, so hosts without PSEC report the runner as unavailable rather than being modified.
    • Requires Windows 11 with PSEC, observed on 25H2 build 26200.9457 and later. Windows Server 2025 lacks PSEC and is not supported (#42).
    • Each run gets its own sandbox identity, so concurrent runs cannot use each other's grants.
    • Filesystem grants, network blocking, the environment (env, unset_env) and working_dir are supported. tmpfs_paths has no Windows equivalent yet and raises PolicyError (#37).
  • Installing and checking MXC - scripts/check-windows.ps1 -Install downloads the MXC version Cordon is tested against, verifies its hash and Microsoft signature, installs it per user (no administrator rights) or, with -AllUsers, for all users, then checks the sandbox works on the machine. Without -Install it only checks.
  • Preset::System::WINDOWS - Grants the one folder Windows PowerShell needs to autoload cmdlets, %ProgramFiles%\WindowsPowerShell\Modules. C:\Windows itself, including cmd.exe and powershell.exe, is usable without a grant.
  • CLI on Windows - cordon run, check, confirm and inspect work on Windows, and cordon inspect --platform windows prints the MXC config from any platform. The release build of cordon.exe is statically linked, so it ships as a single file; a dynamically linked build with its DLLs beside it is also produced for machines whose security software blocks the static one.
  • cordon run reports policy errors as messages - On every platform, a policy the runner cannot express (such as tmpfs_paths on Windows) now prints an error and exits 1 instead of crashing with a stack trace.
  • Cordon.relaunch looks up its runner only when relaunching - On every platform, the default runner is now resolved after the depth check, so the relaunched copy no longer looks for the sandbox tool from inside the sandbox, where it may be unreadable. On Windows, where a process cannot replace itself, relaunch waits for the sandboxed copy and exits with its exit code; relaunched programs should be statically linked.
  • Preset::Python.for_executable on Windows - Takes the folder holding python.exe as the install root. The macOS/Linux rule of walking up two folders would have granted the parent of the install, and for C:\Python312 the whole drive.
  • cordon inspect --platform macos from Windows - Paths are passed through as written instead of being resolved against the Windows filesystem.

Known issues

  • 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 is an early preview, and Microsoft says its profiles should not yet be treated as security boundaries. Cordon pins the MXC version it is tested against (#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 (an ARM VM, and GitHub's Windows 11 ARM runner), with cordon.exe running under x64 emulation. x64 hardware and other editions such as Windows 11 Pro are not yet tested.
  • Windows: only an x64 cordon.exe is built; ARM machines run it under emulation (#39).
  • Windows: cordon.exe is unsigned. Windows Defender scans it briefly on first run, and some endpoint security products flag the statically linked executable as suspicious and delete it; ESET reported it as Win64/Spy.Agent_AGen.DX, a false positive (#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.