AI agents and secrets
How coding agents like Claude Code and Cursor touch your API keys, what MCP changes, and how to let an agent use a key without handing it over.
- How prompt injection steals API keys, and what stops itSeven documented attacks where hidden text made an AI agent leak keys or private data: where the text hid, what it took, how it got out, and what stops it.
- How to stop Claude Code from reading your .env filesClaude Code opens .env files in your project without asking. The deny rules, sandbox settings and hooks that stop it, and what each one still misses.
- Can Cursor read your .env file? Yes, and how to stop itCursor's agent can open .env files, run cat .env and see keys exported in your shell. What .cursorignore and the sandbox block, and what they miss.
- Why Keyfold's MCP server has no reveal toolA secrets server for AI agents could hand keys to the model. Keyfold's doesn't, on purpose. The seven tools it has instead, and the risk that's still left.
- Is MCP safe for API keys? Prompt injection and secretsMCP is as safe as the server's tools and your approvals. How API keys leak through MCP, what the spec asks for, and a checklist for judging a secrets server.
- How to let Claude Code use an API key without seeing itClaude Code can read .env files and print environment variables. Here is how to let it run your tests with real keys while the values stay out of the chat.