> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Trust and threat model

> Understand which credentials OneCLI keeps out of an agent, where decryption happens, and which risks still need your own controls.

OneCLI lets an agent use a stored credential without putting that credential in its environment or credential files. The gateway inserts the value into the upstream request after it checks access. This protects stored credentials. It does not sandbox the code an agent runs.

## Who you trust

| Component or person | What you trust them with |
| - | - |
| Agent | Its own agent credential and the requests it chooses to make. Treat the agent and its dependencies as untrusted. |
| Gateway | Plain credentials, decrypted requests, upstream responses, and the certificate authority used to inspect HTTPS traffic. |
| API and authentication services | Credential setup, access decisions, sign-in, and the backend operations that need decryption. |
| Instance operator | The running services, encryption keys, backups, database, and gateway certificate authority private key. |
| Upstream service | The credential inserted into its request and everything it returns to the agent. |

A compromised agent should not receive the stored value through OneCLI's inventory or container configuration. It can still use the access you gave its vault. A compromised gateway, API process with decryption access, or operator is outside that protection. Encryption at rest does not protect you from someone who controls the running service and its keys.

## What reaches an agent

Inventory and container setup use placeholders or credential stubs for stored service credentials. The agent also holds its own `oc_agent_` credential. That credential authorizes use of the vault through OneCLI, so protect it even though it is not an upstream API key.

A person's managing key (`oc_key_`) manages resources through the API. It is not an agent credential. Keep managing keys, instance encryption keys, and the gateway's certificate authority private key outside the agent.

The one exception is a key you approve for an agent. When an agent runs `onecli login` and you approve that terminal in the browser after a recent sign-in, the agent stores a managing key so it can connect itself and other agents. That key acts as you in the vaults you can use: an agent holding it can add items, change their permissions, and connect or disconnect agents. It has only the `manage` permission, so it cannot answer approval requests, make another key, or approve another terminal. It expires after 90 days. Revoke it at **Settings** > **API keys**, where it shows as made by `onecli login`. An agent that only uses a vault doesn't need this key: connect it with a one-use connect token instead.

> [!WARNING]
>
> An upstream can return a credential in a response. OneCLI does not promise to
> remove every echoed value. Don't test with an echo service or give agents
> access to a service that returns its own authentication headers.

## Where decryption happens

Decryption is not limited to forwarding an HTTP request. These are the operations that can open encrypted values on the server:

| Location | Why it needs a plain value |
| - | - |
| Gateway request resolution | Build injection rules from stored API keys and app connection credentials. |
| Gateway connection support | Refresh OAuth credentials, obtain scoped provider tokens, read an app's OAuth client secret, or use a source GitHub App private key. |
| Gateway injection cache | Open encrypted cached injection rules. Plain rules stay in a per-process memory cache with a 60-second TTL and a 10,000-entry cap, not in a shared cache. |
| Gateway external vault adapters | Authenticate to 1Password or open a stored Bitwarden value before injection. |
| Gateway database proxy and connection test | Log in to the configured database or check the connection as an authorized person. |
| API app setup and connection maintenance | Read OAuth client configuration, preserve encrypted settings during an edit, and maintain or share GitHub App connections. |
| API container configuration | Check that a stored Anthropic credential can be decrypted. The answer still contains a placeholder, not that value. |
| API CLI sign-in handoff | Open the temporary encrypted copy of a newly created managing key for the terminal's one-time poll. |
| API restore and maintenance jobs | Restore an item version, move data between owners during an upgrade, or re-encrypt stored values under another key. |
| Sign-in and server-side OAuth integrations | Read the client secret or connection token needed by the configured authentication integration. |

Self-hosted stored values use AES-256-GCM with `SECRET_ENCRYPTION_KEY`. New ciphertext uses an owner-bound format: opening it under a different row owner fails. Older ciphertext remains readable. Upgrading the binary does not add owner binding to it.

The gateway's secret wrapper redacts normal formatting, cannot be serialized, and wipes its own buffer on drop. That does not wipe every copy made by an HTTP library, JSON parser, or request buffer. Don't treat process memory, crash reports, or a debugger as safe places for untrusted access.

## When a dependency fails

| Condition | Result |
| - | - |
| Policy or identity data cannot be loaded | The gateway refuses the connection rather than enforcing a partial policy. |
| Request identity is missing | The policy engine blocks the request. |
| A successful policy load returns no published rules | That alone does not block traffic. Item permissions still apply. |
| A granted stored secret cannot be decrypted or resolved | The gateway skips that secret. A request sent without it carries `X-OneCLI-Credential: unavailable` in the response to the agent. |
| A required scoped provider credential cannot be obtained | The gateway does not fall back to the unrestricted stored credential. |
| A shared cache entry cannot be read or decoded | The gateway treats it as a cache miss and resolves again. |

A vault is not an outbound network allowlist. Hosts without a stored credential can still be reachable. Use your container or host network controls when the agent must have no direct internet access.

## Known limits in 3.0

* **Older agent tokens remain usable.** Agents connected before 3.0 can keep using their non-expiring `aoc_` tokens, and the server keeps those tokens in a form it can read back. Disconnect and reconnect these agents to replace that path. They can still use the plain proxy port.
* **A vault's standing connect token is reusable.** A connect token from `onecli tokens create` works once and expires after 15 minutes by default. A vault can also have a standing `oc_connect_` token that never expires. A command that carries it runs inside the sandbox, so a standing credential enters the sandbox. Anyone who copies it can create agents on that vault until you turn it off, and each of those agents can use the whole vault. Turn it off with [the API](/docs/api-reference/connect-tokens/turn-a-vaults-connect-token-off.md). Turning it off does not disconnect agents already created with it, so check the vault's agent list for agents you don't recognize.
* **An agent credential has no expiry by default.** Provisioning can set an expiry. Otherwise disconnect the agent to stop it.
* **A self-hosted proxy URL uses HTTP by default.** The name `HTTPS_PROXY` does not mean the hop to the proxy is encrypted. Keep that hop on a protected network, or [turn on TLS for agents](/docs/self-hosting/configuration.md#tls-for-agents). The hosted service gives agents an `https` proxy URL on port 443.
* **An upstream can echo an injected value.** Response filtering is not a complete defense against this.
* **Access belongs to the vault.** Agents on one vault share its item permissions, including for items added later. Use separate vaults for different access.

## Next steps

* [Review self-hosted configuration](/docs/self-hosting/configuration.md).
* [Configure agent access](/docs/guides/agent-access.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.