All SendBox docs

SendBox · Get started

Configuration

SendBox is configured through YAML. Generate .sendbox.yaml in the project root and then edit it for the selected runtime and policy:

sendbox init --project .
sendbox init --project . --runtime kata
sendbox policy validate --config .sendbox.yaml

The fully annotated reference is config/example-sandbox.yaml.

Example

name: my-agent-sandbox
project_path: ./workspace

runtime:
  provider: auto # auto | apple | kata | hyperlight
  kata:
    executable: nerdctl
    runtime_handler: io.containerd.kata.v2
    namespace: sendbox
  hyperlight:
    kernel_path: /opt/hyperlight/shell-kernel
    initrd_path: /opt/hyperlight/shell.cpio

resources:
  cpus: 2
  memory_mb: 2048
  disk_size_mb: 10240

policy:
  commands:
    default_action: deny
    allowlist:
      - "git *"
      - "npm *"
      - "python3 *"
    denylist:
      - "sudo *"
    log_blocked: true

  network:
    default_action: deny
    allow_dns: true
    # Replace wildcard entries with concrete hostnames when using Hyperlight.
    allowed_domains:
      - github.com
      - "*.github.com"
      - registry.npmjs.org
    blocked_domains: []

  packages:
    enabled: true
    registries:
      - ecosystem: npm
        url: https://registry.npmjs.org/
        allow_insecure_http: false
        signature: if_present
        provenance: if_present
    default_finding_action: deny
    finding_actions:
      - finding: lifecycle_script
        action: deny
    exceptions: []
    limits:
      max_report_bytes: 98304

  boundaries:
    # Set to false when using Hyperlight.
    enabled: true
    tool_calls:
      max_frame_bytes: 1048576
      servers:
        filesystem:
          transport: stdio
          command:
            - /usr/local/bin/node
            - /usr/local/lib/node_modules/@modelcontextprotocol/server-filesystem/dist/index.js
            - /workspaces/my-project
          tools:
            default_action: deny
            allowlist: [read_file, list_directory]
            denylist: ["write_*", "delete_*"]
        github:
          transport: stdio
          command: ["/usr/local/bin/github-mcp-server", "stdio"]
          tools:
            default_action: deny
            allowlist: [search_code, get_file_contents]
            denylist: ["create_*", "update_*", "delete_*"]
        remote-docs:
          transport: streamable_http
          url: https://mcp.example.com/mcp
          tools:
            default_action: deny
            allowlist: [search_docs, get_document]
            denylist: ["create_*", "update_*", "delete_*"]
          http:
            allow_redirects: false
            max_response_bytes: 1048576
            request_timeout_seconds: 30
            authorization:
              bearer_secret: REMOTE_MCP_TOKEN
    syscalls:
      additional_denylist:
        - io_uring_setup
      log_blocked: true
    log_path: /var/log/sendbox/boundary.log

secrets:
  - DATABASE_URL

devcontainer:
  auto_generate: true
  extensions:
    - github.copilot

github:
  forward_auth: true
  forward_copilot_auth: true
  allow_private_repository_access: false
  branch_protection:
    enabled: true
    protected_branches: [main, master]
    allowed_branch_patterns:
      - "{username}/*"
      - "copilot/*"
      - "feature/*"
  safe_outputs:
    enabled: false
    mode: staged
    write_token_env: SENDBOX_SAFE_OUTPUTS_GITHUB_TOKEN

observability:
  mcp_inspection:
    enabled: false
    transports: [stdio]
    capture_payloads: false
    max_payload_bytes: 16384
    log_path: /var/log/sendbox/mcp-trace.log

Rust-generated configuration uses deterministic snake_case YAML, validates before writing, is created atomically with mode 0600, and refuses to overwrite an existing .sendbox.yaml. JSON results are deterministic. Invalid input or configuration returns 2; analysis failures return 3; write failures and no-overwrite refusals return 4. Text diagnostics use stderr, while --json failures use stdout only.

Workload output, runtime failure diagnostics, captured MCP credentials, and Safe Outputs human text are credential-masked by default, without a disable switch. Authentication traffic is not modified. See credential masking for coverage and limits.

Network grants

Apple and Kata enforce exact hostnames, explicit wildcard patterns, IPv4/IPv6 network grants, and deny-first restrictions through DNS, HTTP CONNECT, SOCKS5, and the native CONNECT protocol:

policy:
  network:
    default_action: deny
    allow_dns: true
    allowed_domains: [github.com, "*.tools.example"]
    blocked_domains: [blocked.tools.example]
    blocked_networks: ["203.0.113.9/32"]

*.tools.example matches one.tools.example and nested.one.tools.example, not the apex tools.example, nottools.example, or tools.example.evil. Add the apex separately when needed. Ordinary exact hosts remain exact; they do not implicitly grant subdomains. All CNAME hops must also be admitted.

github.com is an explicit delegation to the official GitHub Meta feed, not an apex-only grant. The host fetches the fixed anonymous HTTPS endpoint https://api.github.com/meta into one cache shared by every session on the machine (~/.sendbox/run/github-meta.json). It reuses that response for up to an hour, then revalidates it with its ETag, so SendBox makes at most about one request per hour per machine. Each session's gateways receive the validated response before readiness and never contact GitHub themselves. Only an effective exact apex grant triggers this behavior: api.github.com, *.github.com, and permissive defaults alone do not. The reviewed network fields and domain/endpoint fields, including their published wildcard patterns, become additional grants. SSH keys, commit keys, fingerprints, and the artifact-attestation trust-domain identity are not destinations. Unknown fields, malformed entries, default routes, and oversized documents are rejected as a whole.

The feed includes shared-cloud CIDRs and wildcard services. This intentionally grants more than GitHub-owned web servers, including published Actions ranges. It is not unlimited Internet access, authentication, or approval to perform GitHub writes. Unlisted hostnames still fail a default-deny domain check even when their address falls in a published range; direct-IP TCP access to that range is allowed, subject to port and explicit-network restrictions. Explicit deny rules, private/link-local/metadata address protections, DNS budgets, reserved MCP origins, package-proxy isolation, and UDP/QUIC denial still apply. Published CIDRs never count as explicit private-address grants.

GitHub allows 60 anonymous API requests per hour per IP address, shared with every other unauthenticated client behind that address. When a refresh fails, including a 403/429 rate limit, the host records the error and waits 60 seconds or until GitHub's published reset before retrying. Meanwhile it keeps using the previous validated response while at least 15 minutes remain of its 24-hour lifetime, and the session's network report shows degraded with the error. Without such a response, the session fails before launch with the typed error and the reset time. It never silently reverts to apex-only behavior. Derived grants expire 24 hours after the host's last successful fetch or conditional revalidation; configured exact hosts and explicit networks are unchanged. An explicit api.github.com deny, disabled DNS, or a TCP/443 exclusion makes a github.com-enabled session fail with an invalid configuration error. Each request has a ten-second deadline, no redirects, environment proxy, or credentials. The cached copy is revalidated with the strict parser on every read, and a corrupt cache is discarded.

A guest receives one validated response at boot and does not refresh it; guest executions are capped at 300 seconds. Already-open tunnels retain their existing maximum 300-second lifetime. A restart installs the same host-supplied response again and cannot reuse earlier DNS pins.

With sendbox run --json, the final network_report: {path, sha256} references a private host-side network-egress-report.json, following the package-report artifact pattern instead of inflating every consumer's result frame. Its digest is recorded in the signed session provenance. The file contains each gateway's configured policy plus latest published scope, body SHA-256, ETag, source/API version, revision, attempt/success/expiry timestamps, freshness, and last failure. The scope is combined with the configured deny/address/port controls; it is not a standalone allow-all policy. The report captures the latest refresh attempt, not a complete transition history or proof that an expired lease is still live. It is available after a normal terminal response, not guaranteed after forced cancellation. policy show --json remains an offline view of configured rules and does not pretend to resolve this live scope.

This requires a matching updated host and signed guest bundle. The boundary plan remains version 3, with a signed network_github_meta admission that binds the response's SHA-256; the internal egress runtime document is version 5, the guest bootstrap is version 5, and network.report is independently versioned at 1. Older guest bundles are rejected, not silently accepted with narrower behavior. Hyperlight has no authenticated production Meta-refresh gateway. No release or consumer activation is implied by a source build.

GitHub and MCP boundaries

GitHub repository forwarding currently supports github.com. Ordinary HTTPS Git uses a fixed authenticated askpass helper rather than assuming GITHUB_TOKEN is consumed automatically. github.ssh_key_path accepts an owner-only private-key file and routes Git SSH through a trusted wrapper with strict host-key checking; the guest image must provide trusted SSH host keys.

Selected-repository git push and git pull operations are branch-protected by default. main and master are denied, while {username}/*, copilot/*, and feature/* are allowed. The username is auto-detected from gh or can be configured explicitly. This guard requires policy.boundaries.enabled; keep GitHub server-side branch protection enabled as defense in depth against direct API ref mutations or alternate Git clients. Disable github.branch_protection.enabled for non-Git projects.

The native Rust admission engine is connected to persistent Apple and Kata sendbox run sessions through authenticated guest bootstrap. It does not replace hosting-provider rulesets or protect alternate clients and direct GitHub API calls.

Local stdio MCP configuration must use /run/sendbox-boundary/mcp-broker -- <exact-approved-command>. Remote project definitions must use the deterministic http://127.0.0.1:15082/mcp/<server-id> route and the configured streamable-http or streamable-http-2025 type; direct upstream URLs and project-supplied credentials are rejected. Stdio and HTTP share exact server resolution, deny-first tool policy, tools/list filtering, call-time checks, and a root-owned audit log. The gateway verifies TLS, revalidates DNS and redirect addresses, pins exact destinations, and keeps bearer credentials out of the agent environment. Legacy 2024 HTTP+SSE and Hyperlight MCP composition fail closed.

Safe Outputs is disabled and staged by default. Enabling github.safe_outputs requires Apple or Kata, policy.boundaries.enabled: true, github.forward_auth: false, no SSH key forwarding, and exact repository and operation limits. The trusted guest installs /run/sendbox-boundary/safe-outputs-mcp; configure it behind the native broker. Apply mode reads SENDBOX_SAFE_OUTPUTS_GITHUB_TOKEN only after the guest, control channel, and secret resolver have been cleaned up. Asset uploads are not supported. A custom write-token name cannot reuse a forwarded Copilot token variable. See the Safe Outputs architecture.

Copilot credentials

github.forward_copilot_auth: true forwards a Copilot credential independently of repository-scoped GitHub authentication. The host resolves it from the first variable that is set, in this order:

Host variableStatus
COPILOT_GITHUB_TOKENSupported
GITHUB_COPILOT_TOKENLegacy compatibility only

Only an absent variable falls through to the next candidate; a variable that is set but empty is a hard error rather than a silent fallback. Repository-scoped credentials (GH_TOKEN, GITHUB_TOKEN) are never consulted for Copilot.

Whichever host variable supplied the value, the guest receives it as COPILOT_GITHUB_TOKEN, the name current GitHub Copilot CLI releases read. Errors name the supported variables and never print a credential value.

Package registry credentials

policy.packages.enabled: true activates the npm-first proxy on Apple and Kata persistent guests. The current implementation requires exactly one npm registry. For private registries, set registries[].credential_secret to a SendBox vault reference. That reference must not also appear in top-level secrets: registry tokens are delivered only to the isolated trusted proxy and are never exposed to the workload.

The proxy forces npm to its loopback endpoint, disables lifecycle scripts, denies direct workload access to the configured upstream, and withholds tarballs until verification and inspection allow them. See the package supply-chain proxy for setup, policy, false-positive handling, reports, and future ecosystem adapter contracts.

Configuration reference

See CLI agents for agent-specific initialization, HTTP/SOCKS proxy environment, native MCP definitions, multi-repository scope, and bounded guest syscall tracing.

SectionKeyDescription
namestringHuman-readable sandbox name
project_pathstringSelected host project and initial guest cwd
workspace_pathoptional stringExplicit enclosing multi-repo mount root; otherwise only the project is shared
runtime.providerenumauto, apple, kata, or hyperlight
runtime.kata.runtime_handlerstringSupported Kata v2 handler; shared-kernel/unverified handlers are rejected
runtime.kata.namespacestringcontainerd namespace
runtime.kata.configuration_pathstringAbsolute Kata config path on the containerd host
runtime.hyperlight.kernel_pathstringHyperlight-compatible Unikraft shell kernel
runtime.hyperlight.initrd_pathstringRootfs CPIO containing the commands or MCP servers to run
resources.cpusintNumber of virtual CPUs
resources.memory_mbintMemory allocation in MB
resources.disk_size_mbintRequested writable-layer size
policy.commandsobjectCommand allowlist/denylist policy
policy.networkobjectOutbound network policy
policy.packagesobjectnpm proxy, verification, finding actions, limits, exceptions, and cache policy
policy.packages.registries[].credential_secretstringVault reference isolated from workload secrets
policy.packages.limits.max_report_bytesintBounded package report size, up to 98304 bytes
policy.boundaries.enabledboolInstall fail-closed MCP and syscall boundaries
policy.boundaries.tool_callsobjectExact stdio/HTTP MCP servers with independent tool and transport policy
policy.boundaries.tool_calls.servers.*.authorizationobjectExplicit stdio environment-auth method and per-server secret references
policy.boundaries.tool_calls.servers.*.http.allowed_auth_methodslistAdmitted HTTP auth methods: none, bearer
policy.boundaries.syscalls.additional_denylistlistExtra syscall names blocked by seccomp
secretslistSecret names injected at runtime
credential_serviceslistBrokered credential service ids from the active governance profile; rejected outside governed sessions
devcontainer.auto_generateboolGenerate a devcontainer spec
github.forward_authboolForward guarded GitHub credentials for the selected repository
github.forward_copilot_authboolForward Copilot authentication independently as COPILOT_GITHUB_TOKEN
github.allow_private_repository_accessboolPermit additional same-organization private repositories
github.ssh_key_pathstringOwner-only SSH private key used by the trusted Git SSH wrapper
github.branch_protection.enabledboolGuard selected-repository pushes and pulls by branch
github.branch_protection.usernamestringUsername used to expand {username} patterns; auto-detected by default
github.branch_protection.protected_brancheslistBranch names that push and pull can never target
github.branch_protection.allowed_branch_patternslistGlob patterns allowed for selected-repository push and pull
github.safe_outputsobjectCredential-free, sealed GitHub write declarations; disabled and staged by default
github.safe_outputs.modeenumstaged for preview-only or apply for host-only GitHub execution
github.safe_outputs.write_token_envstringHost-only environment variable read after runtime teardown
github.safe_outputs.allowed_repositorieslistExact owner/repository write targets
observability.mcp_inspection.enabledboolEnable authenticated local stdio MCP observation on Apple or Kata
observability.syscall_tracingboolRequire cgroup-subtree guest observation and a verified redacted syscall report