Repository navigation
Releases
Release 0.10.2
Cordon 0.10.2
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
- Ruby: gems from
GEM_HOMEandGEM_PATH- The sandbox does not inherit your environment, so gems that a version manager keeps outside Ruby's defaults were not found. chruby, for one, setsGEM_HOMEto~/.gem/ruby/<full version>, where Ruby looks in~/.gem/ruby/<API version>.Preset::Ruby.for_executablenow takes optionalgem_home:andgem_path:: each directory that exists is granted read-only, and the variable is set. Nothing is read from the environment unless you pass it:for_executable(path, gem_home: ENV["GEM_HOME"]?, gem_path: ENV["GEM_PATH"]?). A directory that does not exist yet still gets the variable, but no grant. The static presets take no such arguments. - CLI:
--ruby-gem-env- With--ruby,cordon runandcordon inspectpass their ownGEM_HOMEandGEM_PATHto the preset:cordon run --ruby $(which ruby) --ruby-gem-env -- ruby script.rb. It is an error without--ruby, and warns when neither variable is set.--rubyalone still reads nothing from your environment. - Ruby: the user gem directory is granted only if it exists - The presets granted
~/.gemunconditionally, whichbwrapcannot bind when it is absent, and missed the directory RubyGems uses instead in that case,~/.local/share/gem. They now grant whichever of the two exists.Preset::Ruby.user_gem_dirsreturns them. - Python:
for_venvactivates the venv -Preset::Python.for_venvnow setsVIRTUAL_ENVand puts the venv's executables directory (bin, orScriptson Windows) first onPATH, as the venv'sactivatescript does. Before,python3was the venv's only if your own shell had activated it, so a sandbox started elsewhere ran the base interpreter without the venv's packages. The newpath_env:argument, which defaults to yourPATH, is what follows the venv's directory. The preset'sPATHreplaces yours on merge, asPreset::Crystal's does on macOS, so merge it last or pass your ownPATHaspath_env:. - Docs: toolchain variables -
DEVELOPMENT.mdnow records which variables each toolchain needs in a cleared environment and why the others are left out, with the checks behind it.
Known issues
Preset::Crystalgrants no network, soshards installandshards updateneed--allow-network(orallow_networkin the policy). Without it,gitfails to clone because its HTTPS helper cannot read/etc/ssl/openssl.cnf, which the macOS runner grants only with network access. With it they work, verified on macOS.Preset::Crystalis verified on macOS with the Command Line Tools and on Ubuntu; Xcode.app installs and other Linux distributions are not yet tested. Windows is unsupported:buildraisesUnsupportedPlatformError.- Python and Ruby test suites that write temporary files need a
TMPDIRthe policy grants: without one,tempfileandDir.tmpdirfall back to/tmp, which the macOS runner does not grant. Grant a directory read-write and setTMPDIRinpolicy.env. - Merging
Preset::Python.for_venvwithPreset::Crystalon macOS leaves only thePATHof whichever is merged last. - Linux:
Preset::Systemdoes not grant/etc/alternatives, so on Debian-family systems tools reached through it, such asawk,editorandpager, are not found inside the sandbox. - macOS: a sandboxed process can create semaphores under
/CRYSTAL/. Semaphore names are shared across the machine, so it could take the name another Crystal program needs for its next thread, or exhaust the system's semaphore limit. Both are denial of service, not escape; Cordon does not limit a sandboxed process's resources in any case. - 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 (#47).
- 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.
Release 0.10.1
Cordon 0.10.1
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
Preset::Crystal: a shards cache - The preset now also grantsshardsa cache directory and pointsSHARDS_CACHE_PATHat it, so a sandboxedshards installno longer leaves a.shardsdirectory in the project.buildandwith_temp_dirtake an optionalshards_cache_dir:. By default the cache is ashardsdirectory inside the preset's temp directory: safe, but every run clones its dependencies again. Pass a directory of your own to keep it between runs.- The shared shards cache is riskier than the compiler's - The shards cache holds a git mirror of each dependency, and
shardsrunsgitinside those mirrors. A sandboxed command that can write there can plant a git hook that runs outside the sandbox the next time you install that dependency in any project, lock file or not.Preset::Crystal.shared_shards_cache_dirreturns the cache your ownshardsuses, found the wayshardsfinds it, for callers who accept that. Prefer a cache of your own. - CLI:
--shards-cache DIR-cordon runandcordon inspecttake the shards cache with--crystal-cache, or the shared one whenDIRisshared:cordon run --add brew --add system --crystal-cache ~/.cache/cordon/crystal --shards-cache ~/.cache/cordon/shards --allow-network -- shards install. Without--crystal-cacheit is an error. - macOS: toolchain lookups on every build -
Preset::Crystalnow asksxcode-selectandxcrunfor the developer tools each time it builds a policy, rather than once per process, so a toolchain switched withxcode-select -sor replaced by an update applies to the next run. The lookups take tens of milliseconds.
Known issues
Preset::Crystalgrants no network, soshards installandshards updateneed--allow-network(orallow_networkin the policy). Without it,gitfails to clone because its HTTPS helper cannot read/etc/ssl/openssl.cnf, which the macOS runner grants only with network access. With it they work, verified on macOS.Preset::Crystalis verified on macOS with the Command Line Tools and on Ubuntu; Xcode.app installs and other Linux distributions are not yet tested. Windows is unsupported:buildraisesUnsupportedPlatformError.- Linux:
Preset::Systemdoes not grant/etc/alternatives, so on Debian-family systems tools reached through it, such asawk,editorandpager, are not found inside the sandbox. - macOS: a sandboxed process can create semaphores under
/CRYSTAL/. Semaphore names are shared across the machine, so it could take the name another Crystal program needs for its next thread, or exhaust the system's semaphore limit. Both are denial of service, not escape; Cordon does not limit a sandboxed process's resources in any case. - 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 (#47).
- 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.
Release 0.10.0
Cordon 0.10.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
Preset::Crystal- Lets thecrystalcompiler build, run and spec programs inside the cordon, on macOS and Linux. It grants a cache directory and a temp directory read-write and pointsCRYSTAL_CACHE_DIRandTMPDIRat them. On macOS it also grants the developer tools and setsPATHandSDKROOT, socc,ldand the SDK are found withoutxcrun, whose cache sits in the temporary folder every application shares. On Linux it grants/etc/alternativesand/usr/libexec/gccwhere present, through which Debian-family systems reachccand GCC'scollect2. It grants neither the compiler, nor/bin/sh, nor the network: mergePreset::BrewandPreset::System, and grant network yourself if a command needs it.with_temp_dirandbuild-Preset::Crystal.with_temp_dir(cache_dir:)creates a private temp directory (mode0700, underDir.tempdir), yields the preset and deletes the directory when the block ends, however it ends.Preset::Crystal.build(cache_dir:, temp_dir:)takes a directory you manage yourself. Merge the preset last, and change its directories only through these arguments: settingCRYSTAL_CACHE_DIRorTMPDIRin another policy moves the variable but not the grant. On macOS, pass your ownPATHaspath_env:if your policy sets one.- The compiler cache is the caller's choice - The compiler links a cached object file whenever new code compiles to identical bitcode, so a command that can write to a cache can plant code a later build links.
cache_dirtherefore has no default. Give each sandboxed use a cache of its own, or opt in to the one your own builds use withPreset::Crystal.shared_cache_dir, which finds it the way the compiler does, and accept that the sandbox can write code your next unsandboxed build may link. - CLI:
--crystal-cache DIR-cordon runandcordon inspectmerge the Crystal preset withDIRas its cache, or the shared cache whenDIRisshared, in a fresh temp directory per invocation:cordon run --add brew --add system --crystal-cache ~/.cache/cordon/crystal -- crystal spec. - CLI: a warning when
--envor--unset-envoverrides a preset's variable - The preset's grant for the old value stays, and the new value gets none.cordonnow says so on standard error rather than leaving the command to fail, or to reach a directory you meant to withdraw.
Known issues
Preset::Crystalgrants no network, soshards installandshards updateneed--allow-network(orallow_networkin the policy). Without it,gitfails to clone because its HTTPS helper cannot read/etc/ssl/openssl.cnf, which the macOS runner grants only with network access. With it they work, verified on macOS; sinceHOMEis not passed through, shards keeps its cache in the project's.shardsdirectory rather than~/.cache/shards.Preset::Crystalis verified on macOS with the Command Line Tools and on Ubuntu; Xcode.app installs and other Linux distributions are not yet tested. Windows is unsupported:buildraisesUnsupportedPlatformError.- Linux:
Preset::Systemdoes not grant/etc/alternatives, so on Debian-family systems tools reached through it, such asawk,editorandpager, are not found inside the sandbox. - macOS: a sandboxed process can create semaphores under
/CRYSTAL/. Semaphore names are shared across the machine, so it could take the name another Crystal program needs for its next thread, or exhaust the system's semaphore limit. Both are denial of service, not escape; Cordon does not limit a sandboxed process's resources in any case. - 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 (#47).
- 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.
Release 0.9.0
Cordon 0.9.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
- Breaking, macOS: the sandbox no longer inherits your environment - A sandboxed command on macOS used to see every variable of the process that started it. It now starts with a small passthrough set (
PATH,TERM,LANG,LC_ALL,LANGUAGE,TZandPWD), plus whateverPolicy#envsets (#24). If a command relied on another variable, such asHOME,TMPDIRor a tool's own setting, add it toenv.TMPDIRin particular is better pointed at a directory of the sandbox's own, granted read-write, than at the per-user temporary folder every application shares. - macOS:
Policy#envandPolicy#unset_envare honoured - They were silently ignored before.unset_envalso removes passthrough variables, as on Linux and Windows. - macOS:
Policy#working_diris honoured - The command used to start in the caller's directory whateverworking_dirsaid; the directory was only granted. It now starts inworking_dir, as on Linux and Windows, withPWDnaming it. A relative command such as./toolis now found relative toworking_dir. - Breaking, macOS:
working_dirno longer grants access - When no path list coveredworking_dir, macOS quietly granted it read-write; Linux and Windows never did. Add the directory toread_write_pathsorread_only_pathsif the command needs it. - CLI:
--env KEY=VALUEand--unset-env KEY-cordon runandcordon inspectcan now set and remove variables inside the sandbox, overriding the policy file. Both repeat, and the last flag for a name wins. Policy files never expand$NAME, so this is where a value built from your own environment goes:--env PATH="/opt/tools/bin:$PATH". - macOS: the notification-center rule in
BASELINEtakes effect - It matched the shared-memory name withliteral, which matches only file paths, so it never applied and tools such asldanddsymutillogged a denial each time they started. It now usesipc-posix-name, and those reads are allowed as intended. - macOS:
Cordon.relaunchworks - Its depth counter travels inPolicy#env, so on macOS the relaunched program never saw it, tried to relaunch again, and failed. - Runner implementers:
Launch#envandLaunch#chdir- ALaunchcan now carry the complete environment its launcher starts with, and the directory it starts in;run,spawnandexecapply both. The protectedexecutetakes theLaunchrather than its argv. Code that only calls Cordon is unaffected.
Known issues
- macOS: a sandboxed process can create semaphores under
/CRYSTAL/. Semaphore names are shared across the machine, so it could take the name another Crystal program needs for its next thread, or exhaust the system's semaphore limit. Both are denial of service, not escape; Cordon does not limit a sandboxed process's resources in any case. - 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 (#47).
- 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.
Release 0.8.1
Cordon 0.8.1
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
- macOS: programs built with Crystal 1.22 run in the sandbox - From Crystal 1.22, every thread of a Crystal program on macOS creates a named semaphore, the main thread included, at startup. The sandbox denied this, and because of a Crystal bug (crystal-lang/crystal#17685) the program then hung at full CPU instead of reporting an error. This affected the
crystalcompiler,shards, and any app built with Crystal 1.22 that usesCordon.relaunch. The macOS baseline now lets a sandboxed process create and remove semaphores whose names start with/CRYSTAL/, and nothing more: opening another program's semaphore stays denied. Linux and Windows were not affected. - Tested with Crystal 1.22 - CI now builds and runs the specs with Crystal 1.22 and 1.21 on every platform, and with 1.20 on Linux. The Windows release builds use Crystal 1.22.
Known issues
- macOS: a sandboxed process can create semaphores under
/CRYSTAL/. Semaphore names are shared across the machine, so it could take the name another Crystal program needs for its next thread, or exhaust the system's semaphore limit. Both are denial of service, not escape; Cordon does not limit a sandboxed process's resources in any case. - 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 (#47).
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.
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.
Release 0.7.1
Cordon 0.7.1
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
- Windows: MXC 1.0.0 - Cordon now uses
@microsoft/mxc-sdk1.0.0, MXC's first stable release, and emits its1.0.0config contract. MXC 1.0.0 rejects the configs Cordon 0.7.0 produced, and Cordon 0.7.1 looks forwxc-exec.exe1.0.0 only, so the two must be upgraded together.- Action required: rerun
scripts/check-windows.ps1 -Install(add-AllUsersif you installed for all users). It installs 1.0.0 beside the old version. Add-Pruneto delete older versions once the check passes; leave it off if another app on the machine still uses Cordon 0.7.0. - Enforcement is unchanged: network access is still allowed or blocked as a whole, and inbound and host-loopback traffic stay blocked.
- Action required: rerun
check-windows.ps1 -Prune- After a successful check, deletes MXC versions older than the one this Cordon uses from the per-user folder, or with-AllUsersthe all-users folder. Newer versions and unrecognised folders are kept, and nothing is deleted unless the current version is installed there.- Tested with Crystal 1.21 - CI now builds and runs the specs with Crystal 1.21 on Windows and on some of the macOS and Linux runners.
Known issues
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.
Release 0.7.0
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.runselects 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) andworking_dirare supported.tmpfs_pathshas no Windows equivalent yet and raisesPolicyError(#37).
- Installing and checking MXC -
scripts/check-windows.ps1 -Installdownloads 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-Installit only checks. Preset::System::WINDOWS- Grants the one folder Windows PowerShell needs to autoload cmdlets,%ProgramFiles%\WindowsPowerShell\Modules.C:\Windowsitself, includingcmd.exeandpowershell.exe, is usable without a grant.- CLI on Windows -
cordon run,check,confirmandinspectwork on Windows, andcordon inspect --platform windowsprints the MXC config from any platform. The release build ofcordon.exeis 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 runreports policy errors as messages - On every platform, a policy the runner cannot express (such astmpfs_pathson Windows) now prints an error and exits1instead of crashing with a stack trace.Cordon.relaunchlooks 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,relaunchwaits for the sandboxed copy and exits with its exit code; relaunched programs should be statically linked.Preset::Python.for_executableon Windows - Takes the folder holdingpython.exeas the install root. The macOS/Linux rule of walking up two folders would have granted the parent of the install, and forC:\Python312the whole drive.cordon inspect --platform macosfrom Windows - Paths are passed through as written instead of being resolved against the Windows filesystem.
Known issues
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 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 withshell: 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.exerunning under x64 emulation. x64 hardware and other editions such as Windows 11 Pro are not yet tested. - Windows: only an x64
cordon.exeis built; ARM machines run it under emulation (#39). - Windows:
cordon.exeis 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 asWin64/Spy.Agent_AGen.DX, a false positive (#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.
Release 0.6.5
Cordon 0.6.5
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) and Linux (via bwrap / Bubblewrap), presenting both as a single clean API.
Changes
- HTTPS works on macOS when network access is allowed - With
allow_networkenabled, the macOS runner now also grants read access to the system TLS directory,/private/etc/ssl. Previously the network was reachable but TLS configuration was not.- Linux already bound
/etc/ssland/etc/ca-certificateswhen network access is allowed. Coverage across distributions with other layouts is tracked separately.
- Linux already bound
cordon inspect --platform macosoutput is a valid profile - The header line is now an SBPL comment (;) rather than#, socordon inspect ... > profile.sbcan be passed straight tosandbox-exec -f, as the debugging workflow in DEVELOPMENT.md describes.
Known issues
Policy#envandPolicy#unset_envare honoured on Linux but silently ignored by the macOS runner, which inherits the parent environment instead. See #24.
For architecture, design decisions, and debugging workflows see DEVELOPMENT.md.
Release 0.6.4
Cordon 0.6.4
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) and Linux (via bwrap / Bubblewrap), presenting both as a single clean API.
Changes
- Timezone-aware commands now work on macOS - The macOS baseline grants read access to the system timezone database. Previously any sandboxed process that formatted a local time — Ruby's
Time, Python'szoneinfo, Go'stime, anything Foundation-linked — silently fell back to UTC instead of the requested zone. No error was raised, so the symptom was wrong output rather than a failure. Custom policies that worked around this by adding timezone paths by hand can drop them./usr/share/localewas unaffected and needed no change; it is a real directory on macOS and was already covered by the existing/usr/sharegrant.- Linux was already correct —
/usr/share/zoneinfois a plain directory there and has been in the baseline all along.
Known issues
Policy#envandPolicy#unset_envare honoured on Linux but silently ignored by the macOS runner, which inherits the parent environment instead. See #24.
For architecture, design decisions, and debugging workflows see DEVELOPMENT.md.