# FAFO: Don't Get Got

> Source: <https://neonronin.sh/blog/stop-putting-model-keys-in-the-sandbox/>
> Published: 2026-11-30 02:15:52+00:00

**Key takeaway:** Run a self-hosted credential broker that stores upstream keys encrypted and issues sandboxes grants valid from one second to seven days, so a breached sandbox provider gets only a revocable placeholder token instead of your real OpenAI, Anthropic or OpenRouter key.

# FAFO: Don't get got.

Infra providers keep getting popped for the AI keys they store, so stop handing yours to sandbox providers. Run your own credential broker and give sandboxes short-lived grants instead.

Never trust nobody…. Never hold no weight on you.

— The Notorious B.I.G., [“Ten Crack Commandments”](https://www.youtube.com/watch?v=ot9NT9W0Fog)

Biggie tried to warn us. Yet we all keep handing over creds, even though infra folks keep getting hit with the digital equivalent of smash and grabs.

OpenCode, Railway and Northflank all got owned in the last couple of months. They get pop’d, the bad guys, grab the OpenAI / Anthropic / OpenRouter keys, burn the credits reselling or use them for a distillation attack. Companies like these are sitting on a pile of spendable keys, and folks have noticed. Providers revoke, rotate and post the incident report, but all of that happens after your key is already out the door and your accounts drained. And these “another one got got” stories are way too normal.

I trust AWS, GCP and Cloudflare with long-lived credentials. They’ve been around the block and are presumably bomb proof. Theres like 2 sandbox providers that IMHO have the engineering pedigree or history that I’d extend similar trust too. But all those budget sandbox provider that, lets be honest, probably vibe coded their credential storage in a rush to get their shit out for demo day? Yea, fuck that. I’m not fucking handing over my keys.

If I can help it, the sandbox, and the company running it, should never hold a credential that can spend my money or get into my accounts. And sure some providers now offer a secrets proxy that keeps the key away from the agent. That fixes only half the problem, the provider still stores your key, and the provider is exactly who’s getting pop’d. Until some of these folks start open-sourcing some stuff - or like I dunno hit their “1 year anniversary of being in business”, im not handing over my keys.

## Self-host a credential broker?

So whats a dev with a spare claude/codex reset to do? Build and ship your own credential broker of course (or you know…just use one of the existing open-source ones).

A credential broker holds the real keys and hands out place holders. You run it somewhere you control, like a Cloudflare Worker in your own account, and it keeps the upstream keys encrypted. The agent/app in a sandbox then gets a **short-lived grant** instead: a temporary token plus a base URL that points at the broker. You use the grant exactly like a normal API key. When the grant expires or you revoke it, access stops. **The real key is never disclosed to the agent or an app in the sandbox or …the fucking sandbox provider.**

I built one for this: I creatively named [credential broker](https://beachside.run/docs/credential-broker/) ([GitHub](https://github.com/beachside-compute/credential-broker)).

It handles OpenRouter, Anthropic, OpenAI, GitHub and any HTTPS API that takes a key. Grants last anywhere from a second to 7 days.

The broker also splits who can do what. There’s a admin key that you wanna guard really closely, a grant issue key - for the things that need to hand out access, and the actual grants that you’ll push into the sandboxes.

The grant does live in the sandbox’s environment. That’s the gotcha: if the provider gets owned, the attacker walks away with a place holder token. But its one that only works through your broker, only for the integrations you picked, and only until it expires or you kill it. That’s still a much better day than rotating every model key you own when your openrouter keys all leak. Plus if you get creative with Cloudflare tunnel, tailscale, ngrok, IP filtering, etc you can lock down access to your broker A LOT.

Theres also much more feature complete open source solutions like [Varlock](https://varlock.dev) that you could look at, but - it does a lot. Theres also a few “open core” solutions. I wanted something simple and focused, so here we are.

## So…

The broker isn’t the end state. It’s the thing you can do today so you’re not one more incident report away from rotating every model key you own and arguing with a provider about the bill. The real keys stay where you control them, and the sandboxes only get temporary, killable access.

The long-term fix is *probably* something like short-lived tokens and proper workload identity everywhere. Most model providers aren’t there yet. Until they are, I’m putting a credential broker between my sandboxes and my keys.

TO recap, for fucks sake, don’t trust your agent with keys, and don’t trust your budget sandbox provider’s vibey secrets proxy either. And while your at it…

*Disclaimer: maybe don’t blindly trust my slop broker either! But at least it’s open source, runs in your own Cloudflare account, and you can [go read the code](https://github.com/beachside-compute/credential-broker) before you hand it anything.*

My rant is finished here, if you wanna play with the credential broker…

## FAFO and play with the broker

You need Bun, Node.js 22 or later, a Cloudflare account that can deploy Workers and Durable Objects, and an OpenRouter key. This part doesn’t need Beachside at all, so it works with whatever sandbox or orchestrator you already use.

**1. Deploy the broker** to your own Cloudflare account:

```
git clone https://github.com/beachside-compute/credential-broker.git
cd credential-broker
bun install --frozen-lockfile
bun run --cwd services/credential-broker wrangler login
bun run deploy:setup   # deploys, saves the broker URL to .env.deploy, prints the admin and issuer keys once
```

Setup prints the admin and issuer keys once. So you don’t constantly get prompted for keys, save both in your password manager and point `.env.deploy` at them. The file only ever holds references, never the keys themselves, and the encryption key never leaves the Worker.

```
echo 'BROKER_ADMIN_KEY=op://Private/beachside-broker/admin' >> .env.deploy
echo 'BROKER_ISSUER_KEY=op://Private/beachside-broker/issuer' >> .env.deploy
```

`bws://`, `pass://` and `env:NAME` references work too, and with no key configured the commands just prompt for it at the terminal.

**2. Add OpenRouter.** Pick OpenRouter, keep the ID `openrouter`, and paste your key at the masked prompt. The broker encrypts it and lets the issuer key grant `openrouter`.

```
bun run broker status
bun run broker integration setup
```

**3. Issue a grant and use it.**

```
bun run broker grant issue openrouter --ttl 15m --label quickstart
```

You get back a grant ID, a base URL and a `bsg_…` token. Those two go wherever the key used to go:

```
export OPENROUTER_BASE_URL=https://beachside-credential-broker.your-subdomain.workers.dev/gateway/openrouter
export OPENROUTER_API_KEY=bsg_...
curl -s -o /dev/null -w "%{http_code}\n" -H "Authorization: Bearer $OPENROUTER_API_KEY" "$OPENROUTER_BASE_URL/key"
```

A `200` means the broker swapped the grant for your real key. Drop those same two variables into any sandbox and an OpenAI-compatible client in there just works. Done early? `bun run broker grant revoke <grant-id>`.

## With Beachside

If you’re provisioning sandboxes with [Beachside](https://beachside.run), save the broker once and ask for grants at create time:

```
beachside broker add work --deployment .env.deploy
beachside create --name agent --network internet --grant openrouter
beachside rm agent   # destroys the sandbox and revokes the grant
```

The grant lands in the sandbox’s environment, so every later `beachside exec`, shell and background process sees it. It lasts an hour by default. For an always-on agent, pass `--grant-ttl 7d` and renew it with `beachside broker grant renew agent --ttl 7d`; renewal keeps the same token, so whatever’s running doesn’t notice. `beachside broker grant revoke agent` cuts it off without killing the sandbox.

## References

- **OpenCode:**[OpenCode’s post](https://x.com/opencode/status/2111519637049319818) (October 17). A “large scale distillation attack” hit 1.4% of OpenCode Console users, the ones who had linked their own providers. OpenAI and Anthropic keys saved in their workspaces may have been exposed through a legacy system OpenCode was decommissioning.
- **Railway:**[security disclosure](https://blog.railway.com/p/security-disclosure-wednesday-october-21st) (October 21) and[incident report](https://blog.railway.com/p/incident-report-october-security-incident) (November 10). At most 1.85% of workspaces (about 100,000) could have had env vars decrypted. AI provider keys were the primary target, with about $740,000 in unauthorized spend. The report notes OpenCode, Warp, Fireworks AI and others disclosed similar thefts between October 6 and 23.
- **Northflank:**[status updates](https://status.northflank.com/cmvv0rn5a092f14rutwccodpp) (from October 30) and[incident report](https://northflank.com/blog/incident-report-october-30-security-incident) (November 17). An API vulnerability gave the attacker RCE, and secret values were exfiltrated from 1.5% of customer teams. Reported misuse has all been AI provider keys.
- **Fireworks / Notion:**[Notion’s advisory](https://www.notion.com/security/advisories/security-incident-involving-a-third-party-ai-vendor) (November 12). Notion used Fireworks for inference and for its Insights feature. It revoked Notion API keys found in affected user messages and reported third-party keys to their issuers.
