docs.rs failed to build zerobox-0.2.6
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
zerobox-0.3.3
Zerobox Rust SDK
Rust SDK for zerobox. Sandbox any command with file, network, and credential controls.
[]
= "0.2"
The crate ships both a library (zerobox::Sandbox) and the zerobox binary.
For CLI usage, secrets concepts, the full flag reference, performance numbers, and platform support see the main README.
Quick start
use Sandbox;
let output = command
.arg
.allow_write
.run
.await?;
println!;
println!;
Execution modes
Collect output
let output = command
.arg
.allow_write
.run
.await?;
Stream output
let mut child = command
.arg
.allow_write
.allow_net
.spawn
.await?;
let stdout = child.stdout.unwrap;
let status = child.wait.await?;
Inherit stdio (TTY passthrough)
let status = command
.allow_write
.status
.await?;
Secrets
Pass API keys that the sandboxed process never sees. The proxy substitutes the real value only for approved hosts.
let output = command
.arg
.secret
.secret_host
.secret
.secret_host
.run
.await?;
See the main README for how placeholder substitution works.
Environment variables
let output = command
.arg
.env
.allow_env
.deny_env
.run
.await?;
Profiles
// Default profile loads automatically.
let output = command.run.await?;
// Use a different profile.
let output = command
.profile
.run
.await?;
// Combine multiple profiles (merged left-to-right).
let output = command
.profiles
.run
.await?;
// Opt out of profiles.
let output = command
.no_profile
.allow_read
.run
.await?;
Full access / no sandbox
let output = command
.full_access
.run
.await?;
let output = command
.no_sandbox
.run
.await?;
Builder reference
| Method | Description |
|---|---|
command(cmd) |
Start a new builder for cmd. |
arg(x) / args(xs) |
Append arguments. |
cwd(path) |
Working directory. |
allow_read(path) / deny_read(path) |
Readable / blocked paths. |
allow_write(path) / deny_write(path) |
Writable / blocked paths. |
allow_net(domains) / deny_net(domains) |
Allowed / blocked domains. Pass &[] for all. |
env(k, v) |
Set an env var. |
allow_env(keys) / deny_env(keys) |
Inherit / block parent env vars. |
secret(k, v) / secret_host(k, hosts) |
Secret and its allowed hosts. |
profile(name) / profiles(names) / no_profile() |
Select or skip profiles. |
full_access() / no_sandbox() / strict_sandbox() |
Coarse policy switches. |
snapshot() / restore() |
Record / roll back filesystem changes. |
run() / spawn() / status() |
Terminators (collect / stream / inherit stdio). |
Other SDKs
- TypeScript SDK (npm:
zerobox) - Python SDK (PyPI:
zerobox)
License
Apache-2.0