Deployment and host trust

Secrets on disk

Assume anything under ~/.apus/ (or $APUS_STATE_DIR/) may contain secrets or private data:

Path Contents
apus.json Config may include tokens (gateway, remote gateway), provider settings, and allowlists.
credentials/** Channel credentials (for example WhatsApp creds), pairing allowlists, legacy OAuth imports.
state/apus.sqlite Shared runtime state, including native MCP OAuth access/refresh tokens, dynamic client registration secrets, and discovery state.
agents/<agentId>/agent/apus-agent.sqlite Per-agent runtime state, including model auth profiles.
agents/<agentId>/agent/auth-profiles.json Legacy model-auth migration source; doctor imports supported records into the per-agent SQLite database.
agents/<agentId>/agent/codex-home/** Per-agent Codex app-server account, config, skills, plugins, native thread state, diagnostics (default).
$CODEX_HOME/** or ~/.codex/** Native Codex runtime state. The ordinary harness accesses it only with explicit plugins.entries.codex.config.appServer.homeScope: "user". The separate supervision connection accesses it when its resolved home scope is "user", which is the default for stdio or Unix when unset. Contains the native Codex account, config, plugins, and thread store. Supervision lists source metadata and keeps a continued Chat's canonical native branch and later turns on that connection; branching copies bounded persisted user and assistant history into an authenticated, model-locked Apus Chat. Enable only for an owner-controlled Gateway. See Codex harness and Codex supervision.
secrets.json (optional) File-backed secret payload used by file SecretRef providers (secrets.providers).
agents/<agentId>/agent/auth.json Legacy compatibility file; static api_key entries are scrubbed when discovered.
agents/<agentId>/agent/apus-agent.sqlite Per-agent runtime state, including session rows and transcripts that can contain private messages and tool output.
agents/<agentId>/sessions/** Legacy session migration sources and archives that can contain private messages and tool output.
bundled plugin packages Installed plugins (plus their node_modules/).
sandboxes/** Tool sandbox workspaces; can accumulate copies of files read/written inside the sandbox.

Credential storage map

Also useful for backup decisions:

Hardening: keep permissions tight (700 on dirs, 600 on files); use full-disk encryption on the gateway host; prefer a dedicated OS user account if the host is shared.

File permissions

apus doctor can warn and offer to tighten these.

Workspace .env files

Apus loads workspace-local .env files for agents and tools, but never lets them silently override gateway runtime controls:

Workspace .env files frequently live next to agent code, get committed by accident, or get written by tools; blocking provider credentials prevents a cloned workspace from substituting attacker-controlled provider accounts.

Logs and transcripts

Apus stores session transcripts on disk under ~/.apus/agents/<agentId>/sessions/*.jsonl for session continuity and optional memory indexing - any process/user with filesystem access can read them. Treat disk access as the trust boundary and lock down ~/.apus permissions; run agents under separate OS users or hosts for stronger isolation.

Gateway logs may include tool summaries, errors, and URLs; session transcripts can include pasted secrets, file contents, command output, and links.

Details: Logging

Secret scanning

CI runs the in-repo scripts/detect-private-keys.mts scanner over every tracked regular file except colocated *.test.ts fixtures and the iOS Fastfile; pull requests run the base branch's copy of the scanner and fail if the base branch lacks it. The local detect-private-key pre-commit hook runs the same scanner over the text files pre-commit hands it. If CI fails, remove or rotate the committed key material, then reproduce locally:

node scripts/detect-private-keys.mts