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.

OpenCode, Railway and Northflank all got owned in the last couple of months, and every time the attackers snagged the same thing: the secrets like AI provider keys. Which is their goal. 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 attackers have noticed. Providers revoke, rotate and post the incident report, but all of that happens after your key is already out the door, and “another one got got” stories is starting to feel normal.
Railway says AI provider keys were the “primary target” of its attack and puts the unauthorized spend at about $740,000. Northflank’s attacker scripted searches for sk- and sk-ant- keys. OpenCode told affected users their OpenAI and Anthropic keys may have been exposed through a legacy system it was already decommissioning. Fireworks / Notion is a slightly different flavor: API keys turned up in the Notion AI chat transcripts that Fireworks held. Keys don’t even have to be deliberately stored as secrets to end up somewhere they shouldn’t. Links to all of these are at the bottom of the post.
I trust AWS, GCP and Cloudflare with long-lived credentials. They’ve been around the block and are presumably bomb proof. Theres only like 2-3 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 half the problem, but the provider still stores your key, and the provider is exactly where the last few months of incident reports came from. 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 (or 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 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: the creatively named credential broker (GitHub).

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. Whatever creates your sandboxes (your laptop, a server, a CI job) can only hand out grants. Adding or rotating the real keys takes a separate admin login that you should probably never give to an agent and definitely not store anywhere in plain text. The grant-issuing credential is the one you’ll end up pasting into CI secrets and onto every box that spins up sandboxes, so it’s the one built to do the least damage. If it leaks, someone can use your integrations until you rotate it, but they can’t pull a real key out.
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 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 key leaks. 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 that you could look at, but - it does a lot. Theres also a few “open core” solutions. But, 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 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, 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 (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 (October 21) and incident report (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 (from October 30) and incident report (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 (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.