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)
- Close the agent session and the editor window for that repo. Don't run its install, build or setup scripts again.
- Disable any MCP servers the repo added or that you approved while it was open.
- Move the repo folder somewhere you won't open by accident. Keep it for now if you want to see what it tried to do; don't open it with an agent again.
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:
- The project's .env files and .env files in your other repos (an agent with shell access isn't limited to the folder you opened).
- Git and GitHub credentials: GitHub CLI login (
gh), personal access tokens, SSH keys, credential helpers. - Package registry tokens: npm (
~/.npmrc), PyPI (~/.pypirc). - Cloud CLI credentials: AWS (
~/.aws/), Google Cloud (gcloud), Vercel, Netlify, Supabase, Railway CLI logins. - MCP server configs that hold API keys (for example your Cursor or Claude Code MCP settings).
- AI provider keys (OpenAI, Anthropic and others) in env files or shell profiles.
2. Rotate in this order: biggest blast radius first
- 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.
- Cloud and hosting: AWS access keys, Google Cloud credentials, Vercel tokens. Docs: AWS access keys, gcloud auth revoke, Vercel access tokens.
- 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.
- 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.
- AI provider keys and MCP config keys: these mostly cost you money if abused. Docs: OpenAI API key safety, Cursor MCP, Claude Code MCP.
- 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
- GitHub security log: new tokens, SSH keys, OAuth grants or repo changes you didn't make. Reviewing your security log.
- AWS CloudTrail event history for API calls from the old keys. Viewing CloudTrail events.
- Usage dashboards for Stripe, your database and AI providers: look for spikes since the time you opened the repo.
- npm/PyPI: any version you didn't publish.
4. Check your own repos for anything the agent committed or pushed
- Look at recent commits and pushes across your repos (not just the one you opened), plus new branches, deploy keys, webhooks and GitHub Actions workflows.
- Check that no secret got committed. If one did, rotating it is the fix; rewriting history is cleanup. Removing sensitive data from a repository.
- Turn on GitHub secret scanning where your plan allows it.
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
- Agent session closed, repo moved aside, its MCP servers disabled
- Secret inventory written down (.env files, git/GitHub, npm/PyPI, cloud CLIs, MCP configs, AI keys)
- GitHub tokens, CLI session and unknown SSH keys revoked
- Cloud, hosting, Stripe and database keys rotated (new key in place before the old one is revoked)
- Registry and AI provider keys rotated
- GitHub security log, CloudTrail and usage dashboards checked
- Recent commits, branches, workflows and webhooks across your repos checked
- Free ShipCheck scan of the live app and public repo run