Skip to content

v0.9.1

Latest

Choose a tag to compare

@github-actions github-actions released this 04 Nov 22:32
· 20 commits to main since this release

Highlights

Human-in-the-loop approvals with policy_fn

Sandlock can now pause a syscall while a person decides on it, and keep the sandbox running in the meantime.

  • Approvals no longer stall the sandbox. A held exec, open or connect parks off the supervisor loop, so one pending approval stops only the thread waiting on it. The execve argv freeze is taken after the verdict and re-checked, so it never spans a human decision. New Rust API: PolicyFn::deferred with Approval::{resolve, allow, deny, is_cancelled}; it is also exposed through the FFI. (#302)
  • Configurable verdict timeout, including an unlimited wait, replacing the fixed five seconds. (#296)
  • Grant network access on approval. A sandbox can start offline and open the network when someone approves a connect. net_allow is the launch set; the new PolicyFn.approvable caps what approvals may add. (#307)
  • Event category subscriptions. A callback that only cares about network no longer pays for file syscall trapping, fork tracking and the exec freeze. (#306)
  • Python verdict objects: Allow(), Deny(errno), Audit() and Grant(...) replace the old magic integers and strings. (#308)

Background jobs stay supervised

Each sandbox now runs under a session reaper, so cmd & jobs started by the command stay confined after the main process exits instead of being killed at once.

  • wait() returns main's status and keeps the session; shutdown() ends what is left. (#301)
  • New join() (Rust, C, Python, Go) and sandlock run -j/--wait-jobs wait for every job to finish under supervision. (#310)
  • A Controller can kill, pause and resume from another thread while wait() blocks. (#301)

Security fixes

  • Named unix sockets on Landlock ABI v9. The kernel now gates connect() to named unix sockets, so the child connects in its own name and servers no longer see the embedder's pid as the peer. Older kernels keep the supervisor gate. (#322)
  • /proc link grants are rejected instead of silently dropped. Grant a descriptor with the new fs_read_fd / fs_write_fd, which also pins the grant against symlink swaps. (#331)
  • unshare and setns are denied in --no-supervisor mode, closing the last way to create a user namespace from inside. (#332)

More faithful virtualization

  • sysinfo(2) reports the sandbox's memory limit, load, task count and uptime instead of the host's, which fixes sysconf(_SC_PHYS_PAGES), Node's os module and similar. Every sandbox now reports its own uptime. (#341)
  • --num-cpus now also covers /sys/devices/system/cpu/{online,possible,present}, so os.cpu_count() and getconf _NPROCESSORS_ONLN agree with it. (#336)
  • --uname overrides kernel release, version and other uname fields (CLI, Python, profiles). (#335)

Better behaved as a library

  • No more stderr output. Errors go back to the caller, and diagnostics go through the log facade. A failed COW branch now fails the spawn instead of running without COW. (#318)
  • No more fork hang. The child's environment is now built before fork, so a host thread reading the environment can no longer deadlock a spawn. (#323)
  • disable_registration() lets an embedder skip the per-user name registry and control socket. (#333)
  • A backgrounded sandlock run ... & leaves the terminal alone and no longer makes the login shell exit. (#309)

Fixes

  • Paths named through a held descriptor (/proc/<pid>/fd/N/name) and relative paths now resolve correctly in procfs and COW. (#304, #328)
  • COW serves O_PATH and other openat flag combinations on upper-layer entries, and failed opens are answered instead of being handed to the kernel. (#334)
  • Fixed a hang and a spurious exec denial when the exec freeze met a task waiting on an approval. (#330)

Build and dependencies

  • Landlock handling moved to the landlock crate. (#305, #326)
  • Smaller default build: uuid and jiff removed from the plain supervisor build, plus narrower tokio-util, goblin and nix features (about 17 percent less CPU time for a minimal build). (#319, #329)
  • musl builds work again, cross-compilation honors CC_<target> / TARGET_CC, and a new rust-musl CI job builds for musl and runs the control:: tests. (#324)

Breaking changes

Sandlock is pre-1.0; these change the SDK API without compatibility aliases:

  • Callback configuration moved into PolicyFn (Rust, Python, Go), and the C policy_fn builders now take a timeout and an events mask. (#296, #306)
  • Event category File is renamed Filesystem everywhere, and Memory is removed. (#306)
  • Python callbacks must return verdict objects. (#308)
  • Approval::try_resolve is removed; resolve returns the refused grant. A file: credential inside an fs grant is now a build() error. (#318)
  • wait() no longer kills background jobs; call shutdown() to end them. (#301)
  • The CLONE_ID environment variable is gone from fork clones; use the work_fn argument. (#323)
  • In chroot mode on Landlock ABI v9, named unix connects to host paths fail with EACCES. (#322)
  • A sandbox nested under --no-supervisor can no longer use --user. (#332)

New Contributors

Full Changelog: v0.9.0...v0.9.1