Help us shape the future of Go! Take the 2026 Go Developer Survey

leash

module
v0.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2026 License: GPL-3.0

README

Logo

LeaSH — LLM Execution Audited SHell

A policy-enforced shell execution engine for LLMs and agents.

Getting started

Install
git clone https://github.com/bornholm/leash.git
cd leash
make build          # produces ./leash

Or download a pre-built binary from the Releases page.

Run
# Interactive REPL
./leash --policy policies/default.yaml repl

# One-shot execution
./leash --policy policies/default.yaml exec --exec 'echo hello | tr a-z A-Z'

# MCP server (stdio, for Claude Desktop and other MCP clients)
./leash --policy policies/default.yaml mcp stdio
Use as an MCP tool

Add to your MCP client configuration (e.g. claude_desktop_config.json):

{
  "mcpServers": {
    "leash": {
      "command": "/path/to/leash",
      "args": ["--policy", "/path/to/policy.yaml", "mcp", "stdio"]
    }
  }
}

Features

  • Binary allowlist — only explicitly listed system commands can run
  • AST validation — command count, subshell depth, and background job limits enforced before execution
  • Pattern blocking — substring matches reject dangerous commands before parsing
  • Environment isolation — host environment never inherited; only declared variables are visible
  • Rate limiting — global and per-skill call rate limits
  • Timeout — configurable maximum execution duration per script
  • Audit trail — every command (blocked or executed) logged as structured JSON
  • Filesystem sandbox — bubblewrap (bwrap) or chroot isolation; only bind-mounted paths are accessible
  • MCP transport — expose as an MCP tool server for Claude Desktop and other agents
  • Extensible builtins — register Go functions, Tengo scripts, or shell scripts as shell commands
Filesystem sandbox example
# Install bubblewrap
apt install bubblewrap   # or: pacman -S bubblewrap

# Create the sandbox work directory
mkdir -p /tmp/leash-sandbox

# Run a command: ls /work is isolated to /tmp/leash-sandbox
echo 'ls /work' | ./leash --policy policies/sandboxed.yaml exec

# /etc is not bind-mounted → cat /etc/shadow fails
echo 'cat /etc/shadow' | ./leash --policy policies/sandboxed.yaml exec

Documentation

License

GPL-3.0

Directories

Path Synopsis
cmd
leash command
server command
Command server démarre le serveur MCP HTTP Streaming multi-tenant de LeaSH.
Command server démarre le serveur MCP HTTP Streaming multi-tenant de LeaSH.
examples
basic command
Exemple basic — utilisation de LeaSH comme librairie.
Exemple basic — utilisation de LeaSH comme librairie.
sandboxed command
Exemple : LeaSH avec isolation filesystem via bubblewrap.
Exemple : LeaSH avec isolation filesystem via bubblewrap.
shell command
Exemple shell — builtins dynamiques définis via des scripts shell.
Exemple shell — builtins dynamiques définis via des scripts shell.
tengo command
Exemple tengo — builtins dynamiques définis via des scripts Tengo.
Exemple tengo — builtins dynamiques définis via des scripts Tengo.
internal
pkg
leash
Package leash expose une API publique pour créer et configurer un moteur d'exécution shell sandboxé.
Package leash expose une API publique pour créer et configurer un moteur d'exécution shell sandboxé.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL