Skip to content

Releases

Release 0.10.2

Choose a tag to compare

@nogginly nogginly released this 24 Nov 19:57
Immutable release. Only release title and notes can be modified.
aad9727

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_HOME and GEM_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, sets GEM_HOME to ~/.gem/ruby/<full version>, where Ruby looks in ~/.gem/ruby/<API version>. Preset::Ruby.for_executable now takes optional gem_home: and gem_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 run and cordon inspect pass their own GEM_HOME and GEM_PATH to 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. --ruby alone still reads nothing from your environment.
  • Ruby: the user gem directory is granted only if it exists - The presets granted ~/.gem unconditionally, which bwrap cannot 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_dirs returns them.
  • Python: for_venv activates the venv - Preset::Python.for_venv now sets VIRTUAL_ENV and puts the venv's executables directory (bin, or Scripts on Windows) first on PATH, as the venv's activate script does. Before, python3 was 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 new path_env: argument, which defaults to your PATH, is what follows the venv's directory. The preset's PATH replaces yours on merge, as Preset::Crystal's does on macOS, so merge it last or pass your own PATH as path_env:.
  • Docs: toolchain variables - DEVELOPMENT.md now 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::Crystal grants no network, so shards install and shards update need --allow-network (or allow_network in the policy). Without it, git fails 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::Crystal is 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: build raises UnsupportedPlatformError.
  • Python and Ruby test suites that write temporary files need a TMPDIR the policy grants: without one, tempfile and Dir.tmpdir fall back to /tmp, which the macOS runner does not grant. Grant a directory read-write and set TMPDIR in policy.env.
  • Merging Preset::Python.for_venv with Preset::Crystal on macOS leaves only the PATH of whichever is merged last.
  • Linux: Preset::System does not grant /etc/alternatives, so on Debian-family systems tools reached through it, such as awk, editor and pager, 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 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.

Release 0.10.1

Choose a tag to compare

@nogginly nogginly released this 23 Oct 21:20
Immutable release. Only release title and notes can be modified.
e30cb56

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 grants shards a cache directory and points SHARDS_CACHE_PATH at it, so a sandboxed shards install no longer leaves a .shards directory in the project. build and with_temp_dir take an optional shards_cache_dir:. By default the cache is a shards directory 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 shards runs git inside 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_dir returns the cache your own shards uses, found the way shards finds it, for callers who accept that. Prefer a cache of your own.
  • CLI: --shards-cache DIR - cordon run and cordon inspect take the shards cache with --crystal-cache, or the shared one when DIR is shared: cordon run --add brew --add system --crystal-cache ~/.cache/cordon/crystal --shards-cache ~/.cache/cordon/shards --allow-network -- shards install. Without --crystal-cache it is an error.
  • macOS: toolchain lookups on every build - Preset::Crystal now asks xcode-select and xcrun for the developer tools each time it builds a policy, rather than once per process, so a toolchain switched with xcode-select -s or replaced by an update applies to the next run. The lookups take tens of milliseconds.

Known issues

  • Preset::Crystal grants no network, so shards install and shards update need --allow-network (or allow_network in the policy). Without it, git fails 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::Crystal is 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: build raises UnsupportedPlatformError.
  • Linux: Preset::System does not grant /etc/alternatives, so on Debian-family systems tools reached through it, such as awk, editor and pager, 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 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.

Release 0.10.0

Choose a tag to compare

@nogginly nogginly released this 23 Oct 04:40
Immutable release. Only release title and notes can be modified.
0baa54a

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 the crystal compiler build, run and spec programs inside the cordon, on macOS and Linux. It grants a cache directory and a temp directory read-write and points CRYSTAL_CACHE_DIR and TMPDIR at them. On macOS it also grants the developer tools and sets PATH and SDKROOT, so cc, ld and the SDK are found without xcrun, whose cache sits in the temporary folder every application shares. On Linux it grants /etc/alternatives and /usr/libexec/gcc where present, through which Debian-family systems reach cc and GCC's collect2. It grants neither the compiler, nor /bin/sh, nor the network: merge Preset::Brew and Preset::System, and grant network yourself if a command needs it.
  • with_temp_dir and build - Preset::Crystal.with_temp_dir(cache_dir:) creates a private temp directory (mode 0700, under Dir.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: setting CRYSTAL_CACHE_DIR or TMPDIR in another policy moves the variable but not the grant. On macOS, pass your own PATH as path_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_dir therefore has no default. Give each sandboxed use a cache of its own, or opt in to the one your own builds use with Preset::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 run and cordon inspect merge the Crystal preset with DIR as its cache, or the shared cache when DIR is shared, in a fresh temp directory per invocation: cordon run --add brew --add system --crystal-cache ~/.cache/cordon/crystal -- crystal spec.
  • CLI: a warning when --env or --unset-env overrides a preset's variable - The preset's grant for the old value stays, and the new value gets none. cordon now says so on standard error rather than leaving the command to fail, or to reach a directory you meant to withdraw.

Known issues

  • Preset::Crystal grants no network, so shards install and shards update need --allow-network (or allow_network in the policy). Without it, git fails 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; since HOME is not passed through, shards keeps its cache in the project's .shards directory rather than ~/.cache/shards.
  • Preset::Crystal is 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: build raises UnsupportedPlatformError.
  • Linux: Preset::System does not grant /etc/alternatives, so on Debian-family systems tools reached through it, such as awk, editor and pager, 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 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.

Release 0.9.0

Choose a tag to compare

@nogginly nogginly released this 22 Oct 04:54
Immutable release. Only release title and notes can be modified.
de1b70a

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, TZ and PWD), plus whatever Policy#env sets (#24). If a command relied on another variable, such as HOME, TMPDIR or a tool's own setting, add it to env. TMPDIR in 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#env and Policy#unset_env are honoured - They were silently ignored before. unset_env also removes passthrough variables, as on Linux and Windows.
  • macOS: Policy#working_dir is honoured - The command used to start in the caller's directory whatever working_dir said; the directory was only granted. It now starts in working_dir, as on Linux and Windows, with PWD naming it. A relative command such as ./tool is now found relative to working_dir.
  • Breaking, macOS: working_dir no longer grants access - When no path list covered working_dir, macOS quietly granted it read-write; Linux and Windows never did. Add the directory to read_write_paths or read_only_paths if the command needs it.
  • CLI: --env KEY=VALUE and --unset-env KEY - cordon run and cordon inspect can 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 BASELINE takes effect - It matched the shared-memory name with literal, which matches only file paths, so it never applied and tools such as ld and dsymutil logged a denial each time they started. It now uses ipc-posix-name, and those reads are allowed as intended.
  • macOS: Cordon.relaunch works - Its depth counter travels in Policy#env, so on macOS the relaunched program never saw it, tried to relaunch again, and failed.
  • Runner implementers: Launch#env and Launch#chdir - A Launch can now carry the complete environment its launcher starts with, and the directory it starts in; run, spawn and exec apply both. The protected execute takes the Launch rather 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 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.

Release 0.8.1

Choose a tag to compare

@nogginly nogginly released this 21 Oct 19:07
Immutable release. Only release title and notes can be modified.
9a8b29c

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 crystal compiler, shards, and any app built with Crystal 1.22 that uses Cordon.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#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.

Release 0.8.0

Choose a tag to compare

@nogginly nogginly released this 12 Oct 02:33
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.

Release 0.7.1

Choose a tag to compare

@nogginly nogginly released this 09 Oct 20:41
Immutable release. Only release title and notes can be modified.
97ac889

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-sdk 1.0.0, MXC's first stable release, and emits its 1.0.0 config contract. MXC 1.0.0 rejects the configs Cordon 0.7.0 produced, and Cordon 0.7.1 looks for wxc-exec.exe 1.0.0 only, so the two must be upgraded together.
    • Action required: rerun scripts/check-windows.ps1 -Install (add -AllUsers if you installed for all users). It installs 1.0.0 beside the old version. Add -Prune to 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.
  • 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 -AllUsers the 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#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.

Release 0.7.0

Choose a tag to compare

@nogginly nogginly released this 29 Sep 04:33
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.

Release 0.6.5

Choose a tag to compare

@nogginly nogginly released this 15 Sep 21:59
Immutable release. Only release title and notes can be modified.
41cc97d

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_network enabled, 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/ssl and /etc/ca-certificates when network access is allowed. Coverage across distributions with other layouts is tracked separately.
  • cordon inspect --platform macos output is a valid profile - The header line is now an SBPL comment (;) rather than #, so cordon inspect ... > profile.sb can be passed straight to sandbox-exec -f, as the debugging workflow in DEVELOPMENT.md describes.

Known issues

  • Policy#env and Policy#unset_env are 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

Choose a tag to compare

@nogginly nogginly released this 15 Sep 16:51
Immutable release. Only release title and notes can be modified.
e99811a

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's zoneinfo, Go's time, 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/locale was unaffected and needed no change; it is a real directory on macOS and was already covered by the existing /usr/share grant.
    • Linux was already correct — /usr/share/zoneinfo is a plain directory there and has been in the baseline all along.

Known issues

  • Policy#env and Policy#unset_env are 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.