Credential protection
How AgentConnect keeps code-host tokens, provider API keys, and saved logins out of agent sessions.
Whenever possible, the daemon keeps real credentials out of agent sessions. Instead of the real secret, the session receives a placeholder. When a request goes out to the intended destination, the daemon's credential proxy swaps in the real credential. Anything the agent reads from its environment or local files is useless anywhere else.
Code-host credentials
GitHub, GitLab, and Gitea access works this way in every execution environment: host, srt, microsandbox, Kubernetes pool pods, and sessions that a daemon group runs on another member's machine. It's enabled automatically.
git,gh, andglabwork as usual. The proxy attaches a short-lived token scoped to the target repository and the agent's access level on it.- The session's environment, Git configuration, and files contain no usable token.
- Any token explicitly given to the agent, such as its own
GH_TOKENorGITLAB_TOKENsecret, passes through unchanged. - The old
gh-tokenandglab-tokenhelper commands and theghandglabwrappers have been removed. Scripts should invokegit,gh, orglabdirectly.
What the proxy refuses
| Request | Result |
|---|---|
| A GitHub GraphQL mutation | Refused: GraphQL is read-only. The error points to the agent's code-host tool for that write (pull requests, issues, comments, reviews), and the agent retries with it. |
| A GitLab or Gitea API write | Refused, pointing to the write tool. API reads work normally. |
git push to a read-only repository | Refused because the agent lacks write access. Grant Read & write to allow pushing. |
| A REST write that doesn't target a repository | Refused. GitHub REST writes to a specific repository (such as gh api) go through at the agent's access level. |
Because creating or editing GitHub Projects items and Discussions requires GraphQL mutations, agents can't perform those writes, though reading them still works.
If a session can't reach the proxy (for example, on a Kubernetes runtime image older than the daemon), it starts without code-host credentials and the daemon logs why.
Provider API keys
Model provider API keys use the same proxy. The runtime gets a placeholder, and the proxy injects the real key before forwarding the request to the provider.
| Key | Sessions |
|---|---|
| Organization Infra → Provider keys, for an agent whose Model sign-in is Provider key | Host, srt, and microsandbox, including host sessions a daemon group runs on another member |
| API keys on the daemon's own machine, for the runtimes marked Proxy below | srt and microsandbox |
A Kubernetes install's keys: daemonPool.modelCredentials, modelEgress.clients.<client>.apiKey, and ANTHROPIC_API_KEY, OPENAI_API_KEY, DEEPSEEK_API_KEY, or COPILOT_PROVIDER_API_KEY mapped in daemonPool.runtimeEnvironment | Pool pods (details) |
Any extra headers configured on an organization key are added by the proxy and never enter the session. If you change a key's endpoint, start a new session for the change to take effect.
The following credentials still pass into the session as-is:
- Keys whose endpoint is plain
http://, since placeholder replacement only happens over HTTPS - Keys the daemon can't match to a single HTTPS endpoint for that runtime, such as one using a custom port (the daemon logs a warning once)
- Short-lived per-session keys issued by a key server
- Subscription and OAuth logins (covered below)
- The daemon machine's own keys in a host session, since host sessions can read local files directly anyway
Trust and network
Because the proxy terminates TLS for code-host and provider requests, sessions must trust a certificate authority generated by the daemon. The daemon points the standard CA environment variables (SSL_CERT_FILE, NODE_EXTRA_CA_CERTS, GIT_SSL_CAINFO, REQUESTS_CA_BUNDLE) at a bundle combining system roots, the daemon CA, and any authorities already configured by the operator or session variables.
Sessions connect to the proxy via HTTPS_PROXY. If a client ignores HTTPS_PROXY or pins its own certificates, it sends only the placeholder directly to the code host or provider and gets rejected.
For operators:
- Egress: Because the daemon makes the upstream request, it needs outbound HTTPS access to every code host and provider endpoint its agents use. On Kubernetes, this applies to the daemon pool, not the agent pods.
- Private authorities: The proxy verifies upstream TLS using the daemon's trust roots and any authorities configured for the daemon.
- Outbound proxy: If the daemon itself uses
HTTPS_PROXYto reach the internet, the credential proxy routes upstream requests through it too and respectsNO_PROXY.
Protection by runtime
The rest of this page covers logins saved on a self-hosted Linux daemon. Protection depends on the runtime and login method, and works the same way in srt and microsandbox.
| Runtime | OAuth | API key |
|---|---|---|
| Claude Code | Tool rules | Proxy |
| Codex | Tool rules | Proxy |
| DeepSeek Harness | NA | Proxy |
| OpenCode | Unshielded | Proxy |
| pi | Unshielded | Proxy |
| Grok Build | Unshielded | Proxy |
| Qwen Code | Unshielded | Proxy |
| Oh My Pi | Unshielded | Proxy |
| Amp | NA | Proxy |
| Kimi Code | Unshielded | Proxy |
| Cline | Unshielded | Proxy |
| Devin | Unshielded | NA |
| Antigravity ACP | Unshielded | Proxy |
| GitHub Copilot | Unshielded | Proxy |
| Qoder CLI | Unshielded | Unshielded |
| Qoder CN CLI | Unshielded | Unshielded |
- Tool rules: The runtime blocks its built-in tools from reading or modifying protected credential files.
- Proxy: The real API key stays on the host (supported sources listed below).
- Unshielded: Tools inside the sandbox can read the credential directly.
- NA: This login method isn't covered by the integration.
Claude Code and Codex also keep their tool rules active when using the API proxy.
OAuth and tool rules
OAuth credentials are mounted or copied into the session so the runtime can handle authentication and token refresh.
Claude Code and Codex enforce the same tool rules in both SRT and microsandbox. Claude Code restricts Bash and its file tools (including Read and Edit), while Codex uses permission profiles to block tool access to credential paths. The runtime itself can still read its credentials to authenticate.
These rules only cover the runtime's integrated tools, not arbitrary helper processes or MCP servers. Other runtimes receive OAuth credentials without extra tool restrictions.
API key proxy
For supported logins, the daemon passes a placeholder to the session instead of the real API key. The host proxy swaps in the real key in outgoing request headers, and only for the provider's approved HTTPS endpoint.
In both srt and microsandbox, this covers every saved key in the table below, plus keys set in the daemon's environment or runtime definition: ANTHROPIC_API_KEY for Claude Code, OPENAI_API_KEY for Codex, DEEPSEEK_API_KEY for DeepSeek Harness, and the keys for GitHub Copilot and Antigravity ACP. In srt, it also covers those environment variables for OpenCode.
Credential files imported into the sandbox contain only placeholders. For Oh My Pi, the daemon builds a private SQLite database with placeholders before writing any API-key records. The host's login files aren't modified.
The proxy reads provider settings from the host, so editing configuration inside the sandbox can't redirect a key to another destination. The authorized provider receives the real key, and its responses aren't redacted.
Supported saved keys
| Runtime | Key source |
|---|---|
| Claude Code | primaryApiKey in the active global configuration |
| Codex | OPENAI_API_KEY in CODEX_HOME/auth.json |
| DeepSeek Harness | Standard DEEPSEEK_API_KEY entry in .dsh/.credentials.yaml or .dsh/.env |
| OpenCode | API records in auth.json (type: api) |
| pi | API records in auth.json, or provider keys in models.json |
| Grok Build | Per-model keys in config.toml (model.<id>.api_key) |
| Qwen Code | Model-provider keys in settings.json (including legacy security.auth.apiKey) |
| Oh My Pi | API-key records in agent.db |
| Amp | Native CLI entries in secrets.json (apiKey@<service URL>) |
| Kimi Code | Provider keys in .kimi-code/config.toml (providers.<name>.api_key) |
| Cline | Provider API keys in providers.json (apiKey or auth.apiKey) |
| GitHub Copilot | COPILOT_PROVIDER_API_KEY, sent to COPILOT_PROVIDER_BASE_URL |
| Antigravity ACP | GEMINI_API_KEY (the gemini-api-key sign-in method) |
Provider limits
- DeepSeek uses
https://api.deepseek.comand rejects custom endpoints at startup. - Grok, Qwen, and Kimi Code require an explicit HTTPS endpoint in host configuration (for Kimi Code, the provider's
base_url). - Claude Code, Codex, OpenCode, and pi use supported host provider settings or built-in defaults. Custom Codex providers must set
requires_openai_auth = true. - Oh My Pi uses built-in provider defaults.
- pi, Oh My Pi, and Cline support the default endpoints for Anthropic, OpenAI, DeepSeek, Google, xAI, OpenRouter, Groq, and Mistral. Other Cline providers require an HTTPS
baseUrlin the provider entry. - GitHub Copilot requires an HTTPS
COPILOT_PROVIDER_BASE_URL. - Antigravity ACP uses the Gemini API, or
GOOGLE_GEMINI_BASE_URLif set to an HTTPS endpoint.
If a recognized API key has no supported route, it stays hidden and that provider won't be available (for OpenCode, other configured providers continue working).
Protection only applies to the saved sources listed above. It doesn't automatically cover OS keyrings, command-based keys, arbitrary headers, custom plugins, or new logins created inside the sandbox. It also excludes Amp's separate amp-acp/credentials.json login, Oh My Pi keys stored only in custom model files, Cline's AWS credentials and custom headers, and Kimi Code providers that read their key from an environment variable (api_key_env).
Qoder CLI and Qoder CN CLI keys aren't proxied: personal access tokens are exchanged in the request body, and service account keys require a format that a placeholder can't satisfy. Devin signs in through a browser and has no separate API key login.
Supported endpoints must use HTTPS without custom ports or embedded URL credentials. Protected sessions reject custom TLS trust overrides and conflicting credential mounts.
Existing sessions and key changes
A protected VM reloads an updated host key the next time it resumes after stopping; a running VM keeps its current key. Changing login accounts, provider records, or credential layout can trigger a VM rebuild (see what is preserved).
How is this guide?