$ show anthropics/sandbox-runtime
This is a cross-platform sandbox runtime library developed by Anthropic for securely executing untrusted commands within restricted environments. It is designed to be embedded by AI agent runtimes (such as Claude Code) to enforce network and filesystem access controls, perform TLS-terminating HTTP/SOCKS proxying, and mask credentials like API keys and AWS SigV4 secrets. The system operates as a filtering forward proxy with an optional external 'decider' process for per-request allow/deny/body-inspection verdicts, and it supports Linux (via bubblewrap + seccomp), macOS (via Seatbelt profiles), and Windows (via WFP and a Rust helper). The repository is primarily an application library with a CLI tool (`srt`), not a data or research project. It demonstrates high engineering quality with extensive test coverage, careful security invariants, and thoughtful handling of platform edge cases. However, its complexity is extremeβspanning three OS backends, custom proxy servers, TLS MITM, credential injection, and violation monitoringβand it carries significant drift risks from external binary dependencies, runtime-specific workarounds, and a large test surface with conditional skips.
The LLM identified 4 files worth highlighting for reuse:
Provides IP and CIDR parsing utilities including IPv4-mapped/IPv6-embedded address detection, BlockList helpers, and a DeniedAddressSet for guarding against loopback, link-local, cloud metadata, and user-configured address ranges. This module is self-contained, relies only on Node.js built-ins, and can be extracted for any network security tool requiring address validation or DNS rebinding protection.
Implements a streaming transform that replaces sentinel placeholder strings with real values in HTTP request bodies, with length-matched and non-length-matched modes. It uses bounded memory, handle split sentinel boundaries across chunks, and fails safely if a sentinel is split across chunk boundaries. This is a general-purpose pattern for secret masking in streaming data pipelines, decoupled from any specific credential format.
Provides host pattern matching supporting wildcards (`*` for subdomain matching), port suffixes, IPv6 bracket normalization, and canonicalization (including inet_aton, trailing dot removal). Used for network allow/deny lists. The module is small, has no internal dependencies on other sandbox modules, and is directly reusable in any proxy, firewall, or access control application.
A minimal shell-quoting utility that wraps arguments in POSIX-safe quotes to prevent shell injection, replacing the npm `shell-quote` package with a correct implementation that handles the `!` character (history expansion) properly. This is a drop-in replacement for a common npm package, demonstrating practical craftsmanship in fixing a known bug without external dependencies.