# opencode · Credential handling

> Levels are per column and must not be summed, averaged or ranked. A level states which written criterion the runtime's source meets. It is not a measure of quality or task success. Higher is not always preferable.

Source: "Agent runtime comparison: ten open-source agent runtimes, source review", study of 2026-11-28. Mark notation: `3` is the level in the default deployment; `1→4 [opt: …]` is level 1 by default and level 4 in the named configuration; `s` source-verified, `d` documented or test only. Service dependencies are classes (E embedded, O on demand, R resident service, X external server required), not levels.

- Runtime: [opencode](https://ai-agents-review.com/runtime/opencode.md)
- Column: [Credential handling](https://ai-agents-review.com/column/credential-handling.md) (Execution controls)
- Mark: 1 s
- Default deployment: 1
- Best supported configuration: 1
- Page: https://ai-agents-review.com/cell/opencode/credential-handling

## Rationale

Full env inherited, plaintext credential DB; only *.env read-tool ask and host per-session env replacement

## Rubric criteria for this column

- 0: Full environment inherited, credentials stored in plaintext readable by agent code, no filtering
- 1: Some protection (keychain option, redaction of output, per-command secret injection), but the full environment is still inherited by default
- 2: Default denylist filtering of the environment, but known provider keys or credential files remain reachable by agent code
- 3: Default cleared environment plus allowlist for agent processes; credential stores may still be readable on the same filesystem
- 4: Level 3, plus provider credentials held outside the agent's reach (separate process or broker) **and** auxiliary processes (MCP stdio) also get an allowlisted environment

## Review finding

Local shell inherits the server's full `process.env`, or a per-session replacement the host sets via `PUT /session/:id/environment`. MCP stdio servers inherit the env. Stored credentials are plaintext JSON in the 0600 SQLite DB, which the shell can read. The `*.env` ask rule covers the `read` tool, not shell `cat`. No output redaction. [X96][X101][X102][X103][X104]

## Evidence cited by the mark

- [X101] opencode — https://github.com/anomalyco/opencode/blob/2204311ec6e966db8d67988ab3638ad95a811a46/packages/core/src/shell.ts#L968-L985 — local shell env = per-session override or process.env — [S]
- [X102] opencode — https://github.com/anomalyco/opencode/blob/2204311ec6e966db8d67988ab3638ad95a811a46/packages/core/src/mcp/stdio.ts#L27-L35 — MCP stdio extendEnv true — [S]
- [X103] opencode — https://github.com/anomalyco/opencode/blob/2204311ec6e966db8d67988ab3638ad95a811a46/packages/core/src/credential/sql.ts#L5-L14 — credential value stored as plaintext JSON — [S]

## Evidence also cited by the review finding

- [X96] opencode — https://github.com/anomalyco/opencode/blob/2204311ec6e966db8d67988ab3638ad95a811a46/packages/schema/src/agent.ts#L55-L60 — default permissions allow * with ask for versioned skills and *.env reads — [S]
- [X104] opencode — https://github.com/anomalyco/opencode/blob/2204311ec6e966db8d67988ab3638ad95a811a46/packages/core/src/database/database.ts#L89-L100 — database file chmod 0600 — [S]

## Grading record

- Grader A (default / best): 1 / 1
- Grader B (default / best): 1 / 1
