Home / Guides

Opened a malicious repo with your AI agent? What to rotate, in order

You cloned a repo, opened it in Cursor, Claude Code or another coding agent, and now you think it was booby-trapped. Here is a 10-minute checklist: what an agent session on your machine could have read, what to rotate first, where to look for use since the clone, and how to confirm nothing ended up public.

Published 2026-11-25 · Vendor doc links checked 2026-11-25 · ShipCheck guides

A repo can carry instructions for your agent (rules files, agent config, MCP server definitions, setup scripts, package install hooks). If the agent or a script ran with your normal user account, assume it could read anything that account can read. This guide does not try to tell you whether a specific repo was malicious. It gives you the order of operations if you think it was. Want to know which files a cloned repo can make your agent load in the first place? See AgentRank's workspace-trust table (a sister project).

0. Stop the bleeding (2 minutes)

1. List what the session could read

Write down every secret your user account can reach on that machine. The usual list for a vibe coder:

2. Rotate in this order: biggest blast radius first

  1. GitHub: revoke personal access tokens and the GitHub CLI session, remove SSH keys you don't recognize, and review authorized apps. A GitHub token can push code to every repo you own. Docs: token revocation, gh auth logout, reviewing SSH keys, authorized GitHub apps.
  2. Cloud and hosting: AWS access keys, Google Cloud credentials, Vercel tokens. Docs: AWS access keys, gcloud auth revoke, Vercel access tokens.
  3. Payments and database: Stripe secret and restricted keys, webhook signing secrets, Supabase secret/service_role keys and database passwords. Docs: Stripe API keys, Supabase API keys.
  4. Package registries: npm and PyPI tokens. A stolen publish token lets someone ship a poisoned version of your package. Docs: revoking npm tokens, PyPI docs.
  5. AI provider keys and MCP config keys: these mostly cost you money if abused. Docs: OpenAI API key safety, Cursor MCP, Claude Code MCP.
  6. Everything else in your .env files, then update the new values in your host and redeploy. For host-side steps, see Your host leaked env vars: rotate your keys in 15 minutes.

Create the new key, update it where your app reads it, then revoke the old one. Revoking first can take your app down.

3. Check for use since the clone

4. Check your own repos for anything the agent committed or pushed

5. Confirm nothing is public

Run a free ShipCheck scan on your live app URL and on your public GitHub repo URL. It looks for secrets in your client-side JavaScript, an exposed .env file and missing security headers. It can't see your machine or private repos, so it doesn't replace steps 1 to 4. For more on leaked keys, see Exposed .env file or API key? How to check and rotate.

Copy this checklist

Confirm nothing leaked publicly, free

After you rotate, scan your live app URL or public GitHub repo URL. ShipCheck checks for secrets in your client-side JavaScript, an exposed .env file and missing headers. No signup.

Or open the scan box on the homepage

FAQ

Do I need to rotate everything if the agent never ran a command?

If you are sure no command, script or MCP server ran, your risk is lower. Most agents can read files and run tools, though, and install hooks can run on their own. If you can't be sure, rotate the high-blast-radius items first (GitHub, cloud, payments, database).

Does the ShipCheck scan tell me whether I was hacked?

No. It checks what is publicly visible on your live site or public repo, such as keys in your JavaScript bundle or an exposed .env file. It can't see your computer, private repos or provider logs.

Should I delete the repo?

Delete it once you've finished checking. Until then, keep it closed and away from your agent so you can see what it tried to load.

More guides

Exposed .env file or API key? How to check and rotate

How to find leaked API keys and committed .env files in your repo, JavaScript bundle or live site, rotate them safely, and stop it happening again.

Your host leaked env vars: rotate your keys in 15 minutes

Inventory, rotate the riskiest keys first, revoke the old ones, redeploy and check logs.

Supabase Row Level Security (RLS) checklist for vibe-coded apps

Enable RLS on every table, write auth.uid() policies, keep service_role server-side and test with a logged-out request.