Vault commands
vault_commands
¶
Executor-level vault helpers: route generation + credential-leak scan.
The vault is served per container: the supervisor spawns on container
start via the terok-sandbox OCI hook and reads the per-container
sidecar to bind its proxy. Sandbox owns the unlock / lock /
passphrase verbs (passphrase-tier CRUD on the DB).
What lives here:
routes— regenerateroutes.jsonfrom the YAML agent roster.clean— remove leaked credential files from shared config mounts.scan_leaked_credentials/_is_injected_credentials_file/_is_injected_codex_auth_file— primitives the scan + clean verbs share.
Both verbs operate on host-side files only.
SANDBOX_TREE = _build_sandbox_tree()
module-attribute
¶
VAULT_COMMANDS = (SANDBOX_TREE.find_at(('vault',)),)
module-attribute
¶
scan_leaked_credentials(mounts_base)
¶
Return (provider, host_path) for credential files found in shared mounts.
When the vault is active, real secrets should only live in the vault's sqlite DB — not in the shared config directories that get mounted into containers. This function checks each routed provider's mount for credential files that would leak real tokens alongside phantom ones.
Files injected by _write_claude_credentials_file
are recognised by their dummy accessToken marker and skipped.
Symlinks are rejected to prevent a container from tricking the scan into reading arbitrary host files via a crafted symlink in the shared mount.