terok-sandbox
The hardened-Podman runtime — terok-sandbox launches per-task containers with a credential vault, a gated git server, and an egress firewall.
What it provides
- Hardened container lifecycle — rootless Podman containers.
- Credential vault — long-lived secrets stay in an encrypted database on the host. The container receives short-lived phantom tokens and never sees the real credentials.
- Per-task git gate — a token-authenticated HTTP mirror of an arbitrary upstream git repository. Tasks clone and push through the gate, and the gate forwards to upstream automatically (online mode) or after operator review (gatekeeping mode).
- Shield firewall — installs the terok-shield OCI hooks at setup time and drives the firewall at runtime.
- Clearance in-supervisor — each container's supervisor hosts the terok-clearance hub, verdict server, and desktop notifier, so the operator can authorise blocked outbound connections live.
- Setup as one call — idempotent
terok-sandbox setupinstalls the shield + supervisor OCI hooks and provisions the encrypted credentials DB;terok-sandbox uninstallreverses it.
Where it sits in the stack
terok-sandbox is the boundary layer. Above it, single-task callers (terok-executor) and multi-task orchestrators (terok) treat the sandbox as a black-box "give me a hardened container." Below it, it composes terok-shield for egress filtering and terok-clearance for the operator-in-the-loop verdict path.
Public API
from terok_sandbox import (
# Lifecycle
Sandbox,
SandboxConfig,
RunSpec,
VolumeSpec,
Sharing,
# Runtime backends
PodmanRuntime,
KrunRuntime,
NullRuntime,
ContainerRuntime,
# Vault + credentials
CredentialDB,
SSHManager,
NoPassphraseError,
WrongPassphraseError,
# Gate
GateServer,
GitGate,
mint_gate_token,
# Shield adapter
ShieldManager,
ShieldHooks,
check_environment,
# Per-container wiring / setup state
write_sidecar,
remove_container_state,
sandbox_uninstall,
needs_setup,
)
The full export list lives in
src/terok_sandbox/__init__.py.
CLI
| Command | Purpose |
|---|---|
terok-sandbox setup |
Install shield + supervisor OCI hooks, provision the credentials DB; idempotent |
terok-sandbox uninstall |
Reverse of setup |
terok-sandbox prepare / run / cleanup |
Wire a user-owned container into the sandbox services |
terok-sandbox doctor |
Run host-side sandbox health checks |
terok-sandbox vault … |
Vault status / unlock / lock / passphrase-tier management |
terok-sandbox gate … |
Git gate inspection (gate path <project>) |
terok-sandbox shield … |
Shield hooks install / status / direct control |
terok-sandbox ssh … |
Per-scope SSH key management in the credentials DB |
terok-sandbox credentials encrypt-db |
Encrypt (migrate) a plaintext credentials DB |
Requirements
- Linux with Podman (rootless, ≥ 5.6 recommended)
- systemd ≥ 257 — optional; backs the
systemd-credsvault passphrase tier (gate / vault / clearance run inside the per-container supervisor, no systemd units) - nftables (
nftbinary) — provided by terok-shield's runtime - D-Bus session bus — for the clearance notifier path; the system degrades gracefully when D-Bus is absent
- Python 3.12+
Installation
pip install terok-sandbox
For most users this dependency is pulled in transitively by
terok-executor or terok. Install it directly only when building
a custom orchestrator on top of the sandbox API.
License
Apache-2.0 — see LICENSES/Apache-2.0.txt.
Metadata
Release files for terok-sandbox 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| terok_sandbox-0.5.0.tar.gz | 914.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| terok_sandbox-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.3 MB
Release files / terok_sandbox-0.5.0.tar.gz
| Download URL | terok_sandbox-0.5.0.tar.gz |
|---|---|
| Size | 914.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
570b32d3960ea3d25ad843961aebee9c54eaf8b48fa9f5b83ca0dbdffaed5c45
|
|
BLAKE2b-256 checksum How to use checksums |
9c8b092c25a672df3a865e56fa1575f77ffadae8052cb9a39970c3b68f034045
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.
Transparency logRelease files / terok_sandbox-0.5.0-py3-none-any.whl
| Download URL | terok_sandbox-0.5.0-py3-none-any.whl |
|---|---|
| Size | 430.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
60e9abe6084dec80ddaca3091a1768319979fca2c9a854ad89e24027f5d40cbb
|
|
BLAKE2b-256 checksum How to use checksums |
7cb44b082a9ebeb607d4652e271b4802a9e07f0da5e7eb72f36a25a689677a16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.
Transparency log