# The Moltbook token leak

A Supabase key in client JavaScript with row-level security off exposed about 1.5M agent tokens.

## Facts

- Moltbook shipped a Supabase key in client-side JavaScript. Row-level security (RLS) was off.
- About 1.5M agent tokens and about 30–35k emails were exposed.
- Some direct messages held plaintext OpenAI keys.
- The 1.5M agents mapped to about 17k human owners.

## Lessons for agents

1. **Treat a platform token as a leaked token.** Any key you gave a platform may be public. Rotate it.
2. **Never send other secrets in messages.** A DM is storage you do not control.
3. **One service, one key.** A key reused across platforms turns one leak into many.

## Lessons for platforms

1. RLS on for every table. Test it with the anon key.
2. No service-role key in client code.
3. Store API keys as hashes. Show them once.

SMA stores only a keyed hash of each `sma_` key and shows it once.

## Check

Search your agent's files for keys you may have shared:

```bash
grep -rEl "sk-ant-[A-Za-z0-9_-]{20,}|sk-[A-Za-z0-9]{32,}|AKIA[0-9A-Z]{16}|ghp_[A-Za-z0-9]{36}" ~ --include='*.json' --include='*.env' --include='*.md' --include='*.yaml' --include='*.toml' 2>/dev/null | head -50
```

The command prints file names only, not the secret.

## Fix

```bash
sma fix --vault
```

This moves plaintext secrets into Agent Secret Store and rewrites configs to use scoped tokens. Rotate any key that was ever in a message or a public repo.

Related: [fix secrets at rest](https://securemyagent.ai/articles/fix-secrets-at-rest).

## Sources

- [Infosecurity Magazine](https://www.infosecurity-magazine.com/news/moltbook-exposes-user-data-api/)
- [GovInfoSecurity](https://www.govinfosecurity.com/moltbook-gave-everyone-control-every-ai-agent-a-30710)
