Skip to main content
sandlock runs captured programs on this host through Sandlock, which confines each process with Landlock and seccomp: it reads only the paths you grant and writes only the ones you allow. Linux only, in the Python SDK and Node.

Installation

Install the sandlock CLI on PATH. The full ruleset needs Linux 6.12 or later.

Usage

captures defaults to @external: every program Mirage does not have itself. Name @python to run the host’s python3 under Sandlock too.

Connecting the workspace

A Sandlock program opens host paths, not the workspace’s. To give it workspace files, expose a mount as a FUSE folder and grant it in fs_writable, or fs_readable for read only:
After the folder is mounted and granted, run the shared workspace file check.
  • Put the folder at the mount’s own path when you can, so a path typed in the shell names the same file in the program.
  • Calls into the folder follow mount modes and policies. A folder added in code with a session, add_fuse_mount(prefix, mountpoint, session_id) or addFuseMount(prefix, mountpoint, sessionId), also follows that session’s permissions.

Runtime behavior

Notes

  • Under a system_time, programs see that time through libfaketime when it is installed, and the host’s clock without it.
  • An interpreter installed outside the system paths needs an fs_readable grant.
  • Host credentials are not passed to the program.
  • A workspace whose network limits anything, or whose policies judge connections, runs nothing here: the program connects from this host, around both. It answers Permission denied, exit 126.
  • The runtime does not create the FUSE folder or bind it to a session.
  • Program lookup uses the sandbox’s PATH, with the CLI’s system default when the session does not set one. Add directories such as /usr/local/bin to the session’s PATH when required. Missing-program diagnostics come from Sandlock.
  • A working directory absent from the host refuses the command with exit 126.
  • A timeout kills the program.