Repository navigation
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,openorconnectparks off the supervisor loop, so one pending approval stops only the thread waiting on it. Theexecveargv freeze is taken after the verdict and re-checked, so it never spans a human decision. New Rust API:PolicyFn::deferredwithApproval::{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_allowis the launch set; the newPolicyFn.approvablecaps what approvals may add. (#307) - Event category subscriptions. A callback that only cares about
networkno longer pays for file syscall trapping, fork tracking and the exec freeze. (#306) - Python verdict objects:
Allow(),Deny(errno),Audit()andGrant(...)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) andsandlock run -j/--wait-jobswait for every job to finish under supervision. (#310) - A
Controllercan kill, pause and resume from another thread whilewait()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) /proclink grants are rejected instead of silently dropped. Grant a descriptor with the newfs_read_fd/fs_write_fd, which also pins the grant against symlink swaps. (#331)unshareandsetnsare denied in--no-supervisormode, 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 fixessysconf(_SC_PHYS_PAGES), Node'sosmodule and similar. Every sandbox now reports its own uptime. (#341)--num-cpusnow also covers/sys/devices/system/cpu/{online,possible,present}, soos.cpu_count()andgetconf _NPROCESSORS_ONLNagree with it. (#336)--unameoverrides 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
logfacade. 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_PATHand otheropenatflag 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
landlockcrate. (#305, #326) - Smaller default build:
uuidandjiffremoved from the plain supervisor build, plus narrowertokio-util,goblinandnixfeatures (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 newrust-muslCI job builds for musl and runs thecontrol::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 Cpolicy_fnbuilders now take a timeout and aneventsmask. (#296, #306) - Event category
Fileis renamedFilesystemeverywhere, andMemoryis removed. (#306) - Python callbacks must return verdict objects. (#308)
Approval::try_resolveis removed;resolvereturns the refused grant. Afile:credential inside an fs grant is now abuild()error. (#318)wait()no longer kills background jobs; callshutdown()to end them. (#301)- The
CLONE_IDenvironment variable is gone from fork clones; use thework_fnargument. (#323) - In chroot mode on Landlock ABI v9, named unix connects to host paths fail with
EACCES. (#322) - A sandbox nested under
--no-supervisorcan no longer use--user. (#332)
New Contributors
Full Changelog: v0.9.0...v0.9.1