Expand description
Sandbox layer. Each backend isolates a single short-lived child process that runs an agent task (a dynamic verify, a payload-runner, an ai-tool call). The trait stays independent of every other nyx-agent crate so a future VM backend can ship without dragging core/api/ai changes along.
This crate is published so the nyx-agent binary can be installed
from crates.io with versioned internal dependencies. It is an
implementation detail of Nyx Agent, not a stable public API.
Backends shipped today:
process: fork+exec with no isolation upgrade. The unhardened default used when an operator picks theprocessbackend, or when no stronger backend is available on this host.birdcage: wraps thebirdcagecrate, which compiles to Linux landlock + seccomp or macOS Seatbelt. FS deny-by-default plus a single workspace-write exception; network deny unlessSandboxOpts::allow_loopbackis set.libkrun: macOS-first microVM via HVF (Linux+KVM also supported). Routed through alibkrun-runnerhelper binary so FFI symbol drift cannot crash the daemon.firecracker: Linux+KVM microVM. Routed through anyx-fc-runnerhelper binary.docker: fallback container backend used when no stronger isolation is available; the chain-lane delegates to the docker-compose env-builder for the actual spin-up.
Re-exports§
pub use backend::birdcage::BirdcageSandbox;pub use backend::firecracker::firecracker_host_supported;pub use backend::firecracker::FirecrackerSandbox;pub use backend::firecracker::FirecrackerSpec;pub use backend::libkrun::libkrun_host_supported;pub use backend::libkrun::LibkrunSandbox;pub use backend::libkrun::LibkrunSpec;pub use backend::process::ProcessSandbox;pub use chain_runner::ChainResult;pub use chain_runner::ChainRun;pub use chain_runner::ChainRunner;pub use chain_runner::ChainRunnerError;pub use chain_runner::ChainStep;pub use chain_runner::ChainStepCapture;pub use chain_runner::ChainVerdict;pub use chain_runner::InconclusiveReason;pub use payload_runner::HarnessSource;pub use payload_runner::HarnessSpecInput;pub use payload_runner::PayloadRun;pub use payload_runner::PayloadRunner;pub use payload_runner::PayloadRunnerError;
Modules§
- backend
- Concrete
crate::Sandboximplementations. - chain_
runner - Cross-repo chain attack runner.
- env
- Env-builder: detect docker-compose files across connected repos,
merge into a super-compose, spin up via
docker compose, and tear down at run completion. - payload_
runner - Deterministic payload runner.
- shim
- Wire format shared between
crate::BirdcageSandboxand thenyx-sandbox-shimhelper binary. - workspace
- Workspace snapshot setup for sandboxed runs.
Structs§
- Backend
Selection - Which backend the selector chose, plus a human-readable reason the doctor / live-scan UI surfaces verbatim.
- Lane
Concurrency - Per-lane simultaneous-spinup caps. The chain lane defaults to 2 (a
full env-replay can easily consume several GB of RAM); the fast
lane defaults to 8 (matches the
static_concurrencyceiling on a typical 8-core dev box). - Sandbox
Opts - Options for a single sandboxed child.
- Sandbox
Outcome - The captured result of a single sandboxed run.
Enums§
- Backend
Choice - Operator-facing backend label. Mirrors
nyx_agent_core::config::SandboxBackendbut lives in this crate so the sandbox layer does not depend on core. - Backend
Kind - Which backend produced (or is about to produce) a
SandboxOutcome. - Lane
- Which scan lane the sandbox runs under. The chain lane spins up the full dev-env replay alongside the AI-driven exploitation, which is expensive; it gets a stricter concurrency cap than the fast lane.
- Sandbox
Error - Sandbox error surface. Backend-specific failures are folded into the closest matching variant so callers can program against the trait without reaching for downcasts.
- Sandbox
Status - Final state of a sandboxed child.
Traits§
- Sandbox
- The sandbox surface used by every consumer (chain lane, payload runner,
dynamic verifier). Implementors own a single child at a time: call
Sandbox::runonce, then eitherSandbox::waitorSandbox::killbefore anotherrun.
Functions§
- available_
backends - Lightweight readiness probe: returns the static set of backends
that the platform could run. Construction-time probes
(
probe) further check that the kernel surface + helper binaries are present. - permits_
loopback - Refuse
(Lane::Fast, BackendKind::Birdcage)when a caller asks forallow_loopback. Birdcage cannot scope loopback any tighter than “all network or none” (the field-level note onSandboxOpts::allow_loopbackcovers this), so opening it on the fast lane hands the lightweight verifier child a full egress channel it should never need. Chain-lane tasks legitimately want loopback to reach env-builder services on the host. Every other lane/backend combination passes through unchanged; backends that can scope loopback at the kernel (libkrun, firecracker) are free to allow it on either lane. - probe
- Return
Ok(())ifbackendcan be constructed on this host, else describe why it cannot. Callers use this to short-circuit a doctor check or to fall back to a weaker backend. - select_
backend - Pick a backend for
lanehonouring the operator’schoice. Auto picks the strongest backend that can run on this host: