FAFO: Don't Get Got A developer has released an open-source credential broker, published on GitHub under beachside-compute/credential-broker, that keeps real API keys encrypted on infrastructure the user controls and issues sandboxes short-lived grants lasting from one second to seven days instead of handing over long-lived OpenAI, Anthropic, OpenRouter or GitHub keys. The release follows breaches at OpenCode, Railway and Northflank in recent months in which attackers took stored AI provider keys and burned credits or used them for distillation attacks. The broker separates an admin key, a grant-issue key and the grants pushed into sandboxes, so a compromised sandbox provider obtains only a placeholder token that works solely through the user's broker, for selected integrations, until it expires or is revoked. 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