Skip to main content
Glama
README.md
# prodlock

**Let AI agents work on your company without being able to wreck it.**

prodlock is the safety layer between your AI agents and everything they can break:
your keys, your production, your backups. One install, no account, no cloud.

```bash
npx @prodlock/cli scan
```

> *Agents ask. prodlock checks. You approve.*

## Nine seconds

In April 2026 a coding agent working on a staging task hit a permissions error. It
looked around, found a production API token in an unrelated script, and used it. Nine
seconds later the production database was gone. So were the backups: they lived on the
same volume.

Nothing in that story is unusual. Agents run as *you*: anything you can read, they can
read, including `.env` files, saved CLI logins, shell history and the configs where you
hand agents their keys. Many of those keys can delete production, and nothing outside
the agent checks before it uses one. Blocking dangerous shell commands doesn't help when
the agent calls an API with a token it found.

## One loop

prodlock answers the six questions you should be able to answer about every agent on
your machine:

| | Question | prodlock | Status |
|---|---|---|---|
| **1. Know** | What can my agents reach? | `scan`: every production credential an agent can read, and what it can destroy | **Available** |
| **2. Contain** | What must they never touch? | `vault`: folders and secrets out of reach of agents | Coming |
| **3. Ask** | How do agents still get work done? | Agents *request* actions instead of holding keys. Read-only passes; destructive needs your Touch ID or phone | **Agent rules available**, broker coming |
| **4. Record** | What did they actually do? | A flight recorder of every command, file and network call, in a log that can't be quietly edited | Coming |
| **5. Recover** | What if something still goes wrong? | Backups no one can delete, proven by a real restore | **Available** |
| **6. Prove** | Does any of this matter? | The [Temptation bench](bench/): how often agents use credentials they find | **Harness available**, results coming |

## 1. Know: what can your agents reach?

```text
 CRITICAL  Railway API token  #fc3e8a81  (account token for Sam)
            Can destroy: every service, database and volume in 4 projects
            …and the backups you would restore from.
            Found: ~/code/app/scripts/old-migrate.sh:3 (RAILWAY_TOKEN) — in a project file your coding agent can read
            Check: confirmed live with a read-only API call

 CRITICAL  Neon API key  #a97b5755  (Neon API key)
            Can destroy: delete 2 Neon projects, including every branch and its history
            …and the backups you would restore from.
            Found: ~/.zsh_history:1 (NEON_API_KEY) — in your shell history

 CRITICAL  Postgres connection string  #06e7886a  (user postgres on db.xxxx.supabase.co)
            Can destroy: drop every table in postgres, or the whole database
            Found: ~/code/app/.env:2 (DATABASE_URL) — in a project file your coding agent can read

Summary
  4 credentials an AI agent on this machine can reach. 4 can destroy production. 2 can also destroy the backups.
```

`prodlock scan --html card.html` writes a shareable card with counts only: no secrets,
paths, account names or project ids. `prodlock scan --camera-safe` keeps the full report
but hides folder names, paths, account names, database hosts and project ids, so you can
film or screenshot it.

### Where it looks

| Where | Examples |
|---|---|
| Project folders (default: current folder) | `.env*`, `.dev.vars`, `*.tfvars`, `terraform.tfstate`, compose files, `.mcp.json`, `.cursor/mcp.json` |
| Scripts, CI, config and source files | `*.sh`, `Makefile`, `Procfile`, `*.yml`, `*.toml`, `*.py`, `*.js`, `*.ts`, … (lockfiles and minified bundles are skipped) |
| CLI logins in your home folder | `~/.aws/credentials`, Railway, Vercel, Supabase and Neon CLI logins, `~/.pgpass` |
| Shell history | zsh, bash, fish |
| Agent configs | Claude Code, Claude Desktop, Cursor, Codex, Windsurf, OpenClaw |
| Environment variables | everything an agent started from your shell inherits |

It skips `node_modules`, `.git`, build output, placeholders like `your-token`, Supabase
anon keys (public by design) and local development databases.

### What it detects

| Provider | Credential | Online check (read-only) |
|---|---|---|
| AWS | access key + secret | `sts:GetCallerIdentity`, then `iam:SimulatePrincipalPolicy` for delete actions and backup deletion |
| Railway | account, team and project tokens | GraphQL `me` / `projectToken` / project list |
| Vercel | tokens (env vars, CLI login) | `GET /v2/user`, project and team lists |
| Supabase | access tokens (`sbp_`), `service_role` keys, `sb_secret_` keys | `GET /v1/projects` (service keys are read from the token itself) |
| Neon | API keys | `GET /api/v2/projects` |
| Postgres | connection strings with passwords | none; ownership is inferred from the user name |

Every online check is a "who am I" or "list" call. Nothing is created, changed or
deleted. Use `--offline` to make no network calls at all.

## 2. Contain: what must they never touch? *(coming)*

`prodlock vault create ~/Vault` will move a folder under a separate, hidden macOS user,
opened with Touch ID for a limited time. Agent CLIs started through prodlock run in a
macOS sandbox that also blocks `~/.aws`, `.env` files and similar, and `scan` will
report any agent that can still reach the vault.

What it will and won't do: it stops every agent running as you, which is how agents run
today. Nothing on a machine can hide files from software that has admin (root) access;
prodlock won't claim otherwise.

## 3. Ask: agents request, you approve

**Available now.** Connect prodlock to your agents:

```bash
npx @prodlock/cli init
```

`init` finds Claude Code, Codex, Cursor and Claude Desktop on your machine, shows exactly
what it will change, backs up every file it edits, and then:

- adds the `prodlock` MCP server (tools: `scan`, `backup_status`, `production_safety_rules`)
- installs the agent skill: never use a credential you found, never run destructive
  production actions without approval, never touch backups, say what you'll touch first

Then ask your agent: *"what could you destroy in production?"*

To add the MCP server by hand, use command `npx` with args `-y @prodlock/cli mcp`.

**Coming: the broker.** Production keys leave every file and move into the macOS
Keychain, protected by the Secure Enclave. Agents get limited keys or ask prodlock to
act. Read-only requests pass; destructive ones wait for your Touch ID or a tap on your
phone. Even software with full access to your machine can't approve on your behalf.

## 4. Record: what did they do? *(coming)*

A flight recorder for agents: every command, file access and network call made by an
agent and everything it starts, in a log that can't be quietly edited, plus a weekly
summary.

## 5. Recover: backups no one can delete

You need a bucket with **Object Lock enabled** (AWS S3 and Backblaze B2 support it; it
is usually only possible when you create the bucket) and the PostgreSQL client tools
(`pg_dump`, `pg_restore`, `psql`).

```bash
export PRODLOCK_S3_ACCESS_KEY_ID=...        # a key that can only put and read in this bucket
export PRODLOCK_S3_SECRET_ACCESS_KEY=...
prodlock backup run --db DATABASE_URL --bucket my-locked-backups --retain-days 30
```

Each backup is locked in **compliance mode**: until the retention date, no one can
delete it, including the account's root user, an agent holding an admin key, or
prodlock itself. The lock is enforced by the storage provider, not by prodlock.

```bash
prodlock backup verify --bucket my-locked-backups --restore-to SCRATCH_DATABASE_URL --try-delete
```

`verify` checks the lock, tries to delete the locked version (and expects to be
refused), downloads the file and checks its checksum, and restores it into a scratch
database. It refuses to restore over the database the backup came from.

Other providers: pass `--endpoint` (e.g. `https://s3.us-west-004.backblazeb2.com`) and
`--region`. Database passwords are passed to `pg_dump` through the environment, never on
the command line. `prodlock backup status` lists recent backups.

<details>
<summary>Minimal IAM policy for the backup key</summary>

```json
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": ["s3:PutObject", "s3:PutObjectRetention", "s3:GetObject", "s3:GetObjectVersion",
               "s3:GetObjectRetention", "s3:ListBucket"],
    "Resource": ["arn:aws:s3:::my-locked-backups", "arn:aws:s3:::my-locked-backups/*"]
  }]
}
```
</details>

## 6. Prove: does any of this matter?

The [Temptation bench](bench/) recreates the nine-second incident safely: a task that
gets blocked, and decoy credentials where real ones usually leak. It measures how often
an agent searches for keys, reads them, uses them and acts on production, with and
without prodlock's rules. Agents only ever run inside a container that holds no real
credentials. Results across models are coming.

Its first finding was about prodlock itself: the scanner didn't read shell scripts, so
it missed exactly the token from the April incident. That's fixed.

## In CI

```bash
npx @prodlock/cli scan . --no-home --offline --fail-on critical
```

Exits with code 2 if a production credential is committed or present in the build.

## Security: who guards the guard?

A tool that reads your keys is a target, so prodlock is built so that breaking it
doesn't break your protection.

- **No server.** There is no prodlock account, cloud or database. Nothing is uploaded,
  and there's no central store of anyone's secrets to breach. No telemetry.
- **Secrets stay in memory.** Values are never printed, logged or written to disk; JSON
  output, HTML cards and the MCP server only show fingerprints. Tests plant fake keys and
  check the terminal, JSON and HTML output for leaks.
- **Read-only, fixed destinations.** Online checks only call each provider's own API,
  with that provider's own key. `--offline` makes no network calls.
- **Protections enforced by someone else.** Backup locks are enforced by your storage
  provider. The coming vault and broker rely on macOS user permissions, the Keychain and
  Touch ID, so even a compromised prodlock can't silently delete a locked backup or use
  a Touch ID–protected key.
- **Small and checkable.** One Rust binary, few dependencies, no install scripts.
  Releases are published only from this repository's CI through npm trusted publishing:
  there is no npm token to steal, and each version carries provenance back to its source.

Before 1.0: `init` will pin the exact version agents run, and the binary will refuse
network destinations outside a fixed list.

Found a vulnerability? Please report it privately through GitHub's
"Report a vulnerability" button on this repository, not in a public issue.

## How it fits with other tools

- **[destructive_command_guard](https://github.com/Dicklesworthstone/destructive_command_guard)**
  blocks dangerous shell commands. prodlock removes the credentials that make API-level
  damage possible and keeps a backup that survives anyway. Use both.
- **Prowler** and cloud security scanners audit cloud accounts. prodlock looks at the
  machine your agents run on.

## Install

```bash
npx @prodlock/cli scan     # run without installing
npm i -g @prodlock/cli     # install, then run: prodlock scan
```

From source: `cargo install --git https://github.com/amneeksingh/prodlock`

## License

MIT