Keys and incidents

The Cursor breach started with keys inside AI agent traces. Keep yours out.

Cursor says an attacker copied stored coding agent traces, and some of those traces held API keys in plain text. Those keys opened more of Cursor’s systems. The keys got into the traces because an agent read them or a person pasted them in. If you build with an AI coding agent, your keys can end up in its history the same way. Here’s what happened, what to do if you use Cursor, and a setting we tested that keeps a .env file out of the agent’s history.

TL;DR

  • Cursor’s 13 November update says an attacker used an access key that Cursor had issued to Fireworks AI, its inference provider, after Fireworks exposed it. With it, the attacker copied a bucket of mostly 2025 coding agent traces from sessions not in Privacy Mode.
  • Some traces held unredacted credentials. Cursor says fewer than 0.05% of users had traces exposed and fewer than 0.01% of customers had API credentials exposed. Those credentials opened archived repos, support emails and more.
  • Separately, fake builds 2.1.312 and 2.1.313 of the Claude Code extension sat in Cursor’s marketplace cache for about 11 hours on 29 October. Cursor says uninstalling alone may not be enough.
  • We tested Claude Code: when the agent ran cat .env and replied with only the variable name, the full key was still saved twice in plain text in the local session log.
  • With a deny rule for Read(./.env), the agent refused both cat .env and awk 1 .env, and the key never reached the log.

This guide is for founders and agencies who build apps with an AI coding agent such as Cursor, Claude Code or Codex. Every fact about the incident comes from Cursor’s update of 13 November 2026. We have no inside information. The Claude Code tests in the second half we ran ourselves on 15 November 2026 with Claude Code 2.1.277 and a fake key.

What Cursor says happened

QuestionCursor’s answer
Where it startedAt Fireworks AI, a company that ran AI models for Cursor. Fireworks exposed an access key that Cursor had issued to it.
What was copiedA read-only storage bucket of coding agent traces, mostly from 2025, from sessions not in Privacy Mode. Cursor kept these for model training.
Why it spreadSome traces held credentials in plain text. The attacker used them to reach archived non-production code, limited support data and emails, usage metrics and contact details, some agent conversation summaries, and credentials users had sent to support.
How manyFewer than 0.05% of users had traces exposed. Fewer than 0.01% of customers had API credentials exposed. These are different groups, so don’t add them up. Affected users were told directly.
Fake extensionOn 29 October, fake builds 2.1.312 and 2.1.313 of the Claude Code extension were placed in the cache behind Cursor’s marketplace for about 11 hours. At most 5,000 users could have received them. Anthropic didn’t publish them, and Open VSX never had them.
Not affectedPrivacy Mode prompts and code, customer repositories, production systems, the Cursor app and its official updates, and release signing keys.

If you use Cursor

  1. Check your email from Cursor. If Cursor told you credentials were exposed, rotate every key it listed. If you got no notice, Cursor says your data wasn’t in those traces.
  2. Check the Claude Code extension version. If you installed or updated it in Cursor on 29 October and got 2.1.312 or 2.1.313, follow the clean-up steps in Cursor’s 30 October security notice. Cursor says uninstalling alone may not be enough.
  3. Rotate any key you have ever pasted into an agent chat, in Cursor or anywhere else, if the key still works. You can’t list every place a chat was stored, so treat a pasted key as shared. Where to rotate each kind of key.
  4. Turn on Privacy Mode if your work allows it. Cursor says Privacy Mode prompts and code weren’t affected.

Why keys end up in agent history

A coding agent records what it does: your messages, the commands it runs and what those commands print. If it runs cat .env to “check your config”, the output, keys included, is now part of the session. The same happens when you paste a key into the chat to “just get it working”. That record may be kept on your machine, by the tool’s company, or by the company that runs the model for it, as Fireworks did for Cursor.

Ignore files don’t fully stop this. Cursor’s own docs say .cursorignore blocks files from Agent, Tab and @ mentions, but that the terminal and MCP tools the agent uses “cannot block access” to those files. So an agent that runs a shell command can still read your .env.

What we tested in Claude Code

Claude Code keeps each session as a file under ~/.claude/projects/. We made an empty project with a .env holding a fake OpenAI key, let the agent run cat, and asked it which variable names the file defines.

SetupWhat happened
No deny ruleThe agent ran cat .env and its reply named only OPENAI_API_KEY. The full key was still saved twice in the session file, in plain text. The file was readable only by our user account.
Deny rule for Read(./.env)The agent refused cat .env. Given broad Bash access and told to run awk 1 .env, it refused that too. The key never appeared in the session file.

So a polite answer doesn’t mean the secret stayed out of the record. We tested two commands, not every way a program can read a file, so treat the deny rule as a strong default, not a guarantee. The safest key is one the agent never needs to see.

Keep keys out of agent history

Add this to .claude/settings.json in your project, and commit it so everyone on the project gets it. Deny rules apply straight away, without the folder trust step.

.claude/settings.json
{
  "permissions": {
    "deny": [
      "Read(./.env)",
      "Read(./.env.*)"
    ]
  }
}
  • Never paste a key into a chat. Put it in .env or your host’s environment settings, and ask the agent to use the variable name.
  • Give agents their own keys. Use a separate, low-limit key for development, never your production key, so a leaked trace can only do limited damage. How to cap what a key can spend.
  • Use the narrowest key that works. A Supabase anon key, a Stripe restricted key, a GitHub token scoped to one repo.

Check your own agent history for keys

This lists Claude Code session files that hold something shaped like a key. It prints only file names, not the keys, and nothing leaves your machine.

terminal
grep -rlE "sk-proj-|sk-ant-|sk-or-|sk_live_|rk_live_|ghp_|github_pat_|AKIA[0-9A-Z]{16}" \
  ~/.claude/projects --include='*.jsonl' 2>/dev/null

If it finds a file, rotate the key first. Deleting the file afterwards removes your local copy, but you can’t tell where else the session went, so rotation is the fix. Then run the same check on your code and its git history, or paste your files into the free key check, which runs in your browser.

Sources

The checks behind this guide, each with example code, a self-check and the fix.

Free check

Are any of these keys also in your code?

Paste code, a .env or your built JavaScript bundle into the free key check. It runs in your browser: no request is sent and nothing is stored. It flags secret keys (AI providers, Stripe, AWS, GitHub, database URLs), tells a Supabase anon key from a service role key, and links to where to rotate each one.

Open the free key check

Free, no sign-upNothing leaves your browserSee a sample result

Written by Manraj Singh Dhillon. Last checked 15 Nov 2026. Code samples are synthetic and run against your own project; nothing here names a real app. Spotted a mistake? Tell us.