You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OpenClaw currently has multiple vectors where API keys can leak to the LLM or be exposed in chat. This roadmap proposes a layered approach to comprehensively protect secrets.
Problem: Agents can read any file they have permission to access, including .env files with secrets.
Fix: Implement proper secrets handling:
# Config uses placeholderapiKey: "{{secret:ANTHROPIC_KEY}}"# Agent sees placeholder, never real value# Runtime substitutes when making API call# Output is redacted if key appears accidentally
Summary
OpenClaw currently has multiple vectors where API keys can leak to the LLM or be exposed in chat. This roadmap proposes a layered approach to comprehensively protect secrets.
The Problem
These aren't edge cases. Real users have had keys exposed in chat while debugging.
Proposed Solution: Three Layers
Layer 1: Stop models.json Leak (Quick Fix)
Problem:
models-config.tswrites apiKey tomodels.json, which gets serialized to prompt context.Fix: Strip apiKey from models.json before writing. Store auth credentials separately for authentication only.
Files:
src/agents/models-config.ts(~line 133)src/agents/models-config.providers.tsScope: ~100 lines
Timeline: Days
Impact: Stops LLM provider keys from leaking
Layer 2: Masked Secrets Architecture (#10659)
Problem: Agents can read any file they have permission to access, including .env files with secrets.
Fix: Implement proper secrets handling:
Components:
{{secret:VAR}})Scope: Significant engineering
Timeline: Weeks
Impact: Protects ALL secrets (provider keys, channel tokens, external APIs)
Layer 3: Fix Upstream (pi-coding-agent)
Problem: The
@mariozechner/pi-coding-agentpackage serializes model catalog (including apiKey) to prompt context.Fix: That package should filter secret-looking fields before prompt serialization.
Scope: External dependency
Timeline: Depends on upstream maintainer
Impact: Fixes root cause for all users of that package
Workarounds Available Today
While waiting for platform fixes, users can protect agent-called APIs using Linux user isolation:
This protects keys the agent calls (CRMs, external APIs) but doesn't address LLM provider keys or channel tokens.
Proposed Prioritization
Related Issues
Questions for Maintainers
Happy to help implement any of these layers.