Skip to main content

Safely run untrusted code on your repository in isolated, controlled environments

Project description

Arborinth

Safely run untrusted code on your repository in isolated, controlled environments.

Overview

Arborinth is an experimental tool for safely running untrusted code against a Git repository without granting that code unrestricted access to the host system or the original repository state.

The project is designed around the goal that untrusted code should be able to inspect a repository and make changes, but those changes should happen in an isolated workspace with controlled access to secrets, repository state and the host system.

Arborinth is intended for scenarios where code execution must be treated as potentially unreliable or untrusted. While motivated by the rise of AI coding agents, the scope is intentionally broader than just AI-specific tooling.

Goals

Arborinth aims to provide:

  • Reproducible and isolated execution environments for untrusted workloads.
  • Controlled access to repository state.
  • Writable derived workspaces without mutating the original checkout.
  • Auditability of changes and execution.
  • Local-first workflow.

Sandboxing and isolation build on existing technologies such as containers and virtual machines.

Use Cases

AI Coding Agents

Allow an AI agent to inspect a repository, modify files, run tests, execute linters and create commits. All in its own isolated environment, without directly affecting the original repository or the host environment.

Parallel Execution

Run multiple isolated executions against the same repository state concurrently.

Why "Arborinth"?

Arborinth combines arbor (Latin for tree) and labyrinth.

Each isolated execution environment gets its own derived tree: a writable clone of your repository. With parallel execution, these derived trees form a forest of isolated states growing from the shared origin.

The labyrinth represents the winding, purposeful path you take through this forest: inspecting, testing and comparing derived states in isolation. Unlike a maze where you can get lost, a labyrinth has a single, meaningful path to its destination. You always progress. The original tree remains untouched at the heart of it all.

Status

Arborinth is currently in the early development phase.

A basic implementation of the project, workspace and shell modules exists. The project module can be used to inspect the Git repository root from a given working directory, and the workspace module provides isolated workspaces where untrusted code can operate safely. The shell module provides the ability to run shell sessions or commands inside workspaces.

Concepts

Project

A project represents a top-level Arborinth entity, typically associated with a Git repository. It serves as the central entry point for Arborinth operations.

Workspace

A workspace is an isolated environment derived from a project's Git repository. Each workspace contains its own clone of the repository (in the workdir subdirectory) where untrusted code can perform operations without affecting the original repository or other workspaces.

Shell

The shell module provides the ability to run shell sessions or commands inside workspaces. It uses a jail abstraction to control the execution environment. Currently, a NoneJail backend is available which runs commands directly on the host (without isolation) in the workspace's working directory. This is intended for convenience when you are certain the commands are safe.

Usage

project command

The project subcommand provides operations for managing Arborinth projects.

# Display information about the current project (shows Git root)
arborinth project info

# Use a specific working directory
arborinth project info --workdir /path/to/dir

workspace command

The workspace subcommand provides operations for managing isolated workspaces.

# Create a new workspace (clones the repository)
arborinth workspace create my_workspace

# Create a workspace in a specific project directory
arborinth workspace create my_workspace --workdir /path/to/repo

# List all workspaces for a project
arborinth workspace list

# Display information about a specific workspace
arborinth workspace info my_workspace

# Delete a workspace
arborinth workspace delete my_workspace

shell command

The shell subcommand provides operations for running shell sessions or commands in workspaces.

# Open a shell session in a workspace
arborinth shell my_workspace

# Run a command in a workspace
arborinth shell my_workspace echo "Hello, World!"

# Run a command with flags in a workspace (note the `--` separator)
arborinth shell my_workspace -- git branch --all

Python API

Both Project and Workspace classes can be used programmatically:

from arborinth import Project
from arborinth.shell import JailBackend

# Create a project with the current working directory
project = Project()

# Get the Git repository root
root = project.repo_root_path
print(f"Repository root: {root}")

# Create a workspace
workspace = project.create_workspace("my_workspace")

# Access workspace paths
print(f"Workspace root: {workspace.root_path}")
print(f"Workspace workdir: {workspace.workdir_path}")

# List existing workspaces
workspaces = project.workspaces

# Retrieve a specific workspace
ws = project.workspace("my_workspace")

# Run a shell or command in a workspace
result = ws.shell(args=["echo", "hello"], jail_backend=JailBackend.NONE)
print(f"Exit code: {result.returncode}")

# Delete a workspace
ws.delete()

The Project class validates that the working directory exists and is within a Git repository. Workspace names are validated to prevent path traversal attacks and other security issues. The shell method uses a jail backend to control the execution environment.

Development

Contributions, ideas and feedback are welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arborinth-0.1.0.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

arborinth-0.1.0-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file arborinth-0.1.0.tar.gz.

File metadata

  • Download URL: arborinth-0.1.0.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for arborinth-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4f56a914878b1f0869f33da1a2b3d29822d246343b7e7d9ad5e769c5ad9152be
MD5 010f911599cd644382ef7a721b4b0573
BLAKE2b-256 aef448138e240e63fb6f7f75983409666156735ff1987e684c8a3ecc090c849c

See more details on using hashes here.

File details

Details for the file arborinth-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: arborinth-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for arborinth-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f2b07b0892d6940a17c66f9c70eea7baab16876e28868030f961130f017de5f
MD5 df9901cb61cb901f28de4327597823e7
BLAKE2b-256 08f4dfd9a8979b1673d5b5a84a1598d4295320a7a6badd7e8432927547e18f76

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page