docs: warn agents not to paste API keys in chat#143
Open
jennyruan wants to merge 6 commits intogarrytan:masterfrom
Open
docs: warn agents not to paste API keys in chat#143jennyruan wants to merge 6 commits intogarrytan:masterfrom
jennyruan wants to merge 6 commits intogarrytan:masterfrom
Conversation
API keys pasted into agent chat sessions are stored in conversation logs, creating a security risk. Instead, instruct users to set keys in a separate terminal via ~/.zshenv, then verify availability without printing the values. Discovered when a user followed the current instructions and their OpenAI API key was exposed in the conversation history.
Every recipe told users to copy tokens and paste them directly into the agent chat. Same security conflict as the install doc: agent sessions log all commands to conversation history on the provider's servers. Updated recipes: ngrok-tunnel, x-to-brain, credential-gateway, email-to-brain, calendar-to-brain, twilio-voice-brain. Also added guidance for when users ask 'should I just paste it here?' — answer is always no, with explanation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
GBrain's install instructions tell the agent to ask the user for API keys. The agent
naturally says "run
export OPENAI_API_KEY=sk-..." and the user runs it in the agentchat — the only terminal they have open. The key is now stored in conversation logs.
This is a conflict: gbrain needs API keys, but the agent session is not a safe place
to enter them.
Solution
Three layers of protection:
~/.zshenv,then verify availability without printing values
Before / After
Before: Agent says "run
export OPENAI_API_KEY=sk-..." → key in conversation logsAfter: Agent says "open a separate terminal and run this" → key never enters the chat.
If user pastes key anyway → agent warns to rotate immediately.
Test plan
Context
Discovered during a real Claude Code session. A user followed the current instructions,
pasted their OpenAI API key in the chat, and it was stored in conversation history.
🤖 Generated with Claude Code