# Secrets and API keys in Windsurf (now Devin Desktop): keep credentials out of the agent's reach

Source: https://botpassword.com/agents/windsurf
Last checked: 2026-10-25

Windsurf's editor, with its Cascade agent, is documented as Devin Desktop, and "Windsurf" survives mainly in legacy file paths. It supports MCP over stdio, streamable HTTP and SSE, configured in `mcp_config.json` with `${env:VAR}` and `${file:path}` interpolation. Rules live in `.devin/rules` (or legacy `.windsurf/rules`) and `AGENTS.md`.

## MCP support

Yes. Transports: stdio, http, sse.

- user: `~/.config/devin/mcp_config.json (macOS/Linux; $XDG_CONFIG_HOME/devin/mcp_config.json if set; %APPDATA%\devin\mcp_config.json on Windows)`

## Environment variables and .env files

`${env:VAR_NAME}` is replaced with the variable's value (empty string if unset) and `${file:/path/to/file}` with the file's trimmed contents, in `command`, `args`, `env`, `serverUrl`, `url` and `headers`. The docs advise storing secrets with interpolation rather than hardcoding them. The pages reviewed do not describe `.env` loading.

## File access

Paths listed in `.gitignore`, `node_modules` and hidden paths are excluded from indexing, and files matched by `.gitignore` cannot be edited by the agent. Paths matched by `.devinignore` cannot be viewed, edited or created. The legacy `.codeiumignore` name is still read, and a global ignore file can be placed in `~/.codeium/`.

Deny or ignore files with: .devinignore (legacy .codeiumignore still read).

## Credential risks

- **Prompt-injection exfiltration of `.env` contents.** Security researcher Johann Rehberger reported (disclosed 30 May 2025, published 21 August 2025) that the `read_url_content` tool needs no approval, so a hidden instruction in a file can make Cascade read `.env` and send it to an attacker's server. At publication the post said Windsurf was working on fixes with no ETA.
- **Image rendering leak.** The same report describes data being embedded in image URLs from untrusted domains, leaking information without a human in the loop.
- **Plaintext secrets in config.** The MCP docs recommend `${env:VAR}` or `${file:...}` interpolation over hardcoded values because `mcp_config.json` is a plain file.

## FAQ

### Where is the Windsurf MCP config file?

The current Devin Desktop documentation puts `mcp_config.json` at `~/.config/devin/mcp_config.json` on macOS and Linux and `%APPDATA%\devin\mcp_config.json` on Windows. The docs reviewed do not say where older Windsurf versions kept the file.

### Can Windsurf's Cascade read my .env file?

Files matched by `.gitignore` cannot be edited by the agent and paths in `.devinignore` cannot be viewed, but a researcher showed that a prompt injection could still make Cascade read `.env` and send it out through a web-fetch tool.

### How do I use an environment variable in Windsurf MCP config?

Write `${env:VAR_NAME}` in the `env`, `url` or `headers` fields, or `${file:/path}` to read a value from a file.

### How do I give Windsurf (now Devin Desktop) an API key without it seeing the key?

Don't put the key in the prompt, in a file Windsurf (now Devin Desktop) can read, or in an environment variable it can print. Give it a tool that performs the authenticated step instead: a credential broker exposed over MCP or a CLI that injects the key into the command or HTTP request and returns only the result. BotPassword is that broker, through `bpw mcp` and the `bpw` CLI.

## Sources

- https://docs.devin.ai/desktop/cascade/mcp
- https://docs.devin.ai/desktop/context-awareness/windsurf-ignore
- https://docs.devin.ai/desktop/cascade/memories
- https://embracethered.com/blog/posts/2025/windsurf-data-exfiltration-vulnerabilities/
