Agent leaked his API key and burned $100, so he rebuilt everything with a gateway and OS permissions
Imaginary_Dinner2710 · reddit · 2026-09-06
A developer recounts losing about $100 after giving his agent an API key: while running OpenClaw via OpenRouter for computer-use tasks, he discovered endless requests in Chinese unrelated to his jobs — someone else was using his key, and he had even raised his own spending limit to help them. He never found the leak, but draws a clear lesson: any credential the agent can read is a credential it can copy.
He details the high-privilege scenarios agents need — Git, psql, Stripe webhook debugging, Apify scraping, Cloudflare deploys, logged-in browser sessions — and notes that when he asked Grok Bot if it could read his passwords, it merely promised not to leak them. He wants secrets to be architecturally unreadable.
Over the past few months he rebuilt his setup and is open-sourcing it:
- Agent runs as one Linux user; a separate user holds the keys and runs a gateway
- API calls use placeholder credentials, with the gateway injecting real ones
- CLI wrappers and separate brokers handle other connections
- OS permissions and network rules block the agent from reading credential files or bypassing the gateway
Full technical write-up is in the first comment.
More from coding & agent
- Dev demos AI models handling 3D objects and animations surprisingly well — chongdashu · 2026-10-23
- Jason Kneen burns 104.56B tokens and $24.7K in 304 days of AI coding on Codex and Claude Code — jasonkneen · 2026-10-23
- Typosquatted Blender MCP Repo Hit 958 Stars in Days and Silently Ran Malware — Promptmethus · 2026-10-23
- Benchmarking 56 fresh dependency bugs: MCP routing lifts Claude Code accuracy 68% to 91% — Available_Side_7134 · 2026-10-23
- Swapping only the eval harness moves results 30%: designing agent evals like a scientist — AI Engineer · 2026-10-23
- Med student builds a whole-library RAG with Cognee; single-book ingestion still freezes his machine — shrike293103 · 2026-10-23