In April 2026 a Cursor agent at PocketOS hit a permissions error on a staging task. It went looking for another way through, found a Railway token in an old script, and called the API. The production volume was deleted. The backups lived on that volume, so they went too. About nine seconds, start to finish.

I read that and opened a terminal. My first question wasn't "how do I stop rm -rf". Nothing like that ran in the incident. It was one ordinary API call with a valid key. The question was: what keys can my agent read right now, and what could each one do?

Agents run as you

Claude Code, Cursor and Codex run with your user's permissions. Anything you can open, they can open:

  • .env files in every project
  • deploy and migration scripts with a token pasted in
  • shell history (~/.zsh_history keeps every export FOO=… you ever typed)
  • ~/.aws/credentials and other CLI logins
  • MCP configs where you gave other servers a token

None of that is exotic. It's every laptop I've worked on.

What a check finds

I built a small open-source CLI to answer the question, prodlock. It looks in those places, and for each production credential it finds it asks the provider, read-only, what the key can do. No secret value is printed or uploaded.

Here it is on a demo project (fake keys, --offline so nothing leaves the machine):

prodlock scan on a demo project

 CRITICAL Railway API token Can destroy: Railway services, databases and volumes the token can reach …and the backups you would restore from. Found: acme-app/scripts/deploy.sh:2 (RAILWAY_TOKEN) — in a project file your coding agent can read CRITICAL Supabase service_role key Can destroy: read, change or delete every row in every table, ignoring Row Level Security Found: acme-app/.env:2 (SUPABASE_SERVICE_ROLE_KEY) CRITICAL Postgres connection string (user postgres on db.….supabase.co) Can destroy: drop every table in postgres, or the whole database Found: acme-app/.env:3 (DATABASE_URL) Summary 4 credentials an AI agent on this machine can reach. 4 can destroy production. 1 can also destroy the backups. 

Three files, four keys, and one of them takes the backups down with production. That's the PocketOS shape exactly.

What I changed after running it

  1. Moved production keys out of project folders and history, and rotated the ones that had been in history.
  2. Gave agents weaker keys. Read-only or staging-scoped tokens for agent work; full-power keys stay with me.
  3. Made agents ask. prodlock init adds an MCP server and a skill to Claude Code, Cursor, Codex and Claude Desktop. The rules: never use a credential you found in a file, ask before anything destructive.
  4. Made one backup no key can delete. prodlock backup run dumps Postgres to a bucket with S3 Object Lock in compliance mode; backup verify --restore-to … --try-delete proves it restores and can't be deleted.

Try it

npx @prodlock/cli scan 

Rust, MIT, no account, nothing uploaded. I'd love to hear what it misses, especially providers it doesn't know yet: https://github.com/amneeksingh/prodlock

I built prodlock; this post is about why.