Microsandbox Rust SDK
A Rust SDK for microsandbox - secure self-hosted sandboxes for executing untrusted code. This SDK allows you to create isolated environments for running code with controlled access to system resources.
Installation
Add this to your Cargo.toml
:
[]
= "0.1.0"
= { = "1", = ["full"] }
Usage
Simple Python Sandbox Example
use ;
async
Using Environment Variables
The SDK will automatically read environment variables:
MSB_API_KEY
- Your API key for authenticationMSB_SERVER_URL
- The URL of the microsandbox server (defaults to http://127.0.0.1:5555)
You can also set these values programmatically:
let sb = create.await?;
Features
- Python Sandbox - Run Python code in a secure sandbox
- Shell Commands - Execute shell commands in the sandbox
- Fully Async - Built with modern async/await support
Examples
Check out the examples directory for sample scripts that demonstrate how to:
- Run Python code in a sandbox
- Execute shell commands
- Monitor resource usage
- Configure sandbox options