Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

sandlock

> AI 编程
Open source

The lightest AI sandbox. A process-based sandbox for Linux, no container, no VM, no privilege, no prompt injection

316 stars0 likes1 views
WebsiteGitHub

About

The lightest AI sandbox. A process-based sandbox for Linux, no container, no VM, no privilege, no prompt injection

Sandlock

Lightweight process sandbox for Linux. Confines untrusted code using Landlock (filesystem + network + IPC), seccomp-bpf (syscall filtering), and seccomp user notification (resource limits, IP enforcement, /proc virtualization). No root, no cgroups, no containers.

sandlock run -w /tmp -r /usr -r /lib -m 512M -- python3 untrusted.py

Why Sandlock?

Containers and VMs are powerful but heavy. Sandlock targets the gap: strict confinement without image builds or root privileges. Built-in COW filesystem protects your working directory automatically.

Feature Sandlock Container MicroVM (Firecracker)
Root required No Yes* Yes (KVM)
Image build No Yes Yes
Startup time ~5 ms ~200 ms ~100 ms
Kernel Shared Shared Separate guest
Filesystem isolation Landlock + seccomp COW Overlay Block-level
Network isolation Landlock + seccomp notif Network namespace TAP device
HTTP-level ACL Method + host + path rules N/A N/A
Syscall filtering seccomp-bpf seccomp N/A
Resource limits seccomp notif + SIGSTOP cgroup v2 VM config

* Rootless containers exist but require user namespace support and /etc/subuid configuration.

Architecture

Sandlock is implemented in Rust for performance and safety:

  • sandlock-core: Rust library (Landlock, seccomp, supervisor, COW, pipeline)
  • sandlock-cli: Rust CLI binary (sandlock run ...)
  • sandlock-oci: OCI runtime shim for containerd, CRI-O, and Kubernetes (namespace-less)
  • sandlock-ffi: C ABI shared library (libsandlock_ffi.so)
  • Python SDK: ctypes bindings to the FFI library
  • Go SDK: cgo bindings to the FFI library

See docs/architecture.md for how the pieces fit together and how confinement is applied.

Requirements

  • Linux 6.12+ (Landlock ABI v6), Rust 1.70+ (to build)
  • Python 3.8+ (optional, for Python SDK)
  • No root, no cgroups
Feature Minimum kernel
seccomp user notification 5.6
Landlock filesystem rules 5.13
Landlock TCP port rules 6.7 (ABI v4)
Landlock IPC scoping 6.12 (ABI v6)

Protections can be selectively waived per-policy when needed; see docs/sandbox-reference.md#protection-opt-out.

Install

From source

bash
# Build the Rust binary and shared library
cargo build --release

# Install Python SDK (auto-builds Rust FFI library)
cd python && pip install -e .

CLI only

bash
cargo install --path crates/sandlock-cli

Quick Start

CLI

…

The full option tour (GPU, network grammar, HTTPS MITM, credential injection, port virtualization, chroot, nesting) is in docs/cli.md.

Python API

…

See python/README.md for the SDK guide, including HTTP ACL, chroot mounts, port virtualization, confine(), and deferred commit.

Rust API

…

Documentation

Document Contents
docs/cli.md Every sandlock run option by example, profiles, ps / inspect / kill
docs/sandbox-reference.md Every Sandbox field, default, and TOML key; credentials; protection opt-out
docs/network.md Endpoint grammar, protocol gating, HTTP interception, bind rules, port virtualization
docs/policy-fn.md Dynamic policy callbacks: events, verdicts, context methods, TOCTOU guarantees
docs/pipelines.md Pipelines, the XOA pattern, COW fork and map-reduce
docs/architecture.md Crate layout, confinement sequence, supervisor handlers, COW filesystem
docs/learn.md sandlock learn: generate a profile from an observed run
docs/extension-handlers.md Custom seccomp-notification handlers (Rust and C ABI)
docs/python-handlers.md Custom handlers from Python
python/README.md Python SDK guide
go/README.md Go SDK guide
crates/sandlock-oci/README.md OCI runtime shim

Performance

Benchmarked on a typical Linux workstation:

Workload Bare metal Sandlock Docker Sandlock overhead
/bin/echo startup 2 ms 7 ms 307 ms 5 ms (44x faster than Docker)
Redis SET (100K ops) 82K rps 80K rps 52K rps 97.1% of bare metal
Redis GET (100K ops) 79K rps 77K rps 53K rps 97.1% of bare metal
Redis p99 latency 0.5 ms 0.6 ms 1.5 ms ~2.5x lower than Docker
COW fork ×1000 n/a 530 ms n/a 530μs/fork, ~1,900 forks/sec

Testing

bash
# Rust tests
cargo test --release

# Python tests
cd python && pip install -e . && pytest tests/

Issues· 20 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rustai-agentsfaaslandlocklinux

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
CategoryAI 编程
PricingOpen source

> Related tools

G
GitHub Copilot
GitHub 官方 AI 编程助手,覆盖补全、Chat 与 Agent 模式。
C
Cursor
AI 原生代码编辑器,对话改代码、多文件 Agent 与规则体系是其核心。
S
skills
Skills for Real Engineers. Straight from my .agents directory.