Introduction¶
DSH defaults to bwrap as its process sandbox backend on Linux. bwrap creates an “alternate filesystem view” through namespaces and read-only bind mounts, at the cost of the uid, /proc, and device nodes inside the sandbox being inconsistent with the host—which frequently causes issues with git, ssh, and serial port tools.
This plugin uses only the DSH wrapper around landlock-run: the kernel adjudicates on every file open, without swapping views. Denied paths report EACCES instead of bwrap’s EROFS.
Plugin Scope¶
dsh-sandbox-landlock is a Landlock-only process sandbox backend for DSH, categorized under admin-security. It does not use namespaces or alter the uid view, making it suitable for scenarios that require consistent file access permissions between the sandbox and the host.
Installation & Activation¶
Install from npm (pre-built artifact, recommended):
dsh plugin --profile web add dsh-sandbox-landlock
Or install from GitHub:
dsh plugin --profile web add github:jiesou/dsh-sandbox-landlock
After installation, restart the web profile.
Writable Directories¶
This plugin does not ship its own directory list; it is fully consistent with the official sandbox-policy. Writable directories depend on the mode you configure:
read-only: only/dev/null;workspace-write: the session workspace,/tmp,sandbox-policy.additionalWritableRoots, and directories granted viaregisterWritableRootwithin the session;danger-full-access: the consumer spawns processes directly, bypassing this provider.
All writable directory configurations are written in your own profile layer, not in this plugin package.
Configuring Device Nodes¶
By default, no devices are granted. To access serial ports, ptys, or GPUs, override the sandbox-landlock config in ~/.dsh/profiles/<profile>/cordis.patch.yml:
- id: sandbox-landlock
config:
devicePaths:
- /dev/ttyUSB*
- /dev/ttyACM*
- /dev/hidraw*
- /dev/ptmx
- /dev/pts/*
- /dev/dri/renderD*
| Key | Type | Default | Description |
|---|---|---|---|
devicePaths |
string[] |
[] |
Device nodes requiring read/write access; supports wildcards |
launcherPath |
string |
Auto-detected | Explicitly specify the landlock-run binary |
Wildcards are expanded at the time each command is confined, rather than snapshotted at mount time. Matched directories and non-existent devices are both excluded; excluding non-existent directories does not raise an error.
Caveats¶
This plugin runs with the permissions of the current dsh process and does not alter the process’s uid view. File access to host files within the sandbox is governed by Landlock policies.
Common escape vectors include docker run, flatpak-spawn, systemctl --user start, pre-existing tmux servers (ones created by the agent remain sandboxed), as well as dbus, network access, third-party MCP, and others. These are inherent architectural concerns, not sandbox defects, and require mitigation through other means.
Summary¶
dsh-sandbox-landlock provides a pure Landlock sandbox backend for DSH, suitable for scenarios that require consistent file access permissions between the sandbox and the host. It does not use namespaces or alter the uid view, achieving sandbox isolation through kernel-level file access adjudication.