-
-
Notifications
You must be signed in to change notification settings - Fork 69.4k
[Security]: Resolved secrets written as plaintext to agents/*/agent/models.json #37512
Copy link
Copy link
Closed
Closed
Copy link
Description
Security Report
Environment
- OpenClaw version: 2026.3.2
- OS: macOS (arm64)
Description
The gateway resolves secret references (${ENV_VAR}, SecretRef with Vault/exec/file providers) at startup and writes the resolved plaintext values into agents/*/agent/models.json files on disk.
This means that regardless of the secrets management approach used (environment variables, .env files, Vault exec provider, file provider, etc.), all API keys end up stored as plaintext on disk in models.json under each agent directory.
Impact
Using Vault or any SecretRef provider becomes ineffective because:
- Secrets are resolved at startup and persisted to disk in plaintext
- Every agent gets its own copy of
models.jsonwith full API keys - The security benefits of centralized secret management (audit trail, rotation, access control) are undermined
- File permissions on
models.jsonare not restricted — observed644in some cases
Steps to Reproduce
- Configure API keys using any secret source (
${ENV_VAR}, SecretRef with exec/file provider, etc.) - Start the gateway
- Inspect
$OPENCLAW_STATE_DIR/agents/*/agent/models.json - Observe that all API keys are written in plaintext
Expected Behavior
models.jsonshould NOT contain resolved secret values- Secrets should remain in-memory only after resolution
- If
models.jsonmust be written, secret fields should be redacted or replaced with references
Actual Behavior
Every models.json file under each agent directory contains fully resolved plaintext API keys (provider keys, bot tokens, etc.).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.