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 thesandlock 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.
- Python
- TypeScript
- YAML
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 infs_writable, or fs_readable for read only:
- 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)oraddFuseMount(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_readablegrant. - Host credentials are not passed to the program.
-
A workspace whose
networklimits anything, or whose policies judge connections, runs nothing here: the program connects from this host, around both. It answersPermission 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/binto the session’sPATHwhen 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.