Dev.to AI 🤖 Ai 👁 0 📖 4 min read

We didn't feel comfortable giving our AI agent our API keys

My brother and I have been running AI agents for a few months now — Hermes-based agents that fetch things, send emails, touch GitHub, do real work while we do other things. Once an agent actually finishes a real task for

My brother and I have been running AI agents for a few months now — Hermes-based agents that fetch things, send emails, touch GitHub, do real work while we do other things. Once an agent actually finishes a real task for you, it's hard to go back.

Then comes the part nobody talks about.

The agent needs to send Gmail: here's an app password. It needs GitHub: here's a personal access token. It needs to call the model: here's an API key. One by one we pasted live credentials into config files and hoped that nothing weird would ever show up in the context window.

We kept asking ourselves the same question: what happens the day our agent gets lied to?

The incidents are not hypothetical

While we were debating, the industry was having a bad semester:

  • OpenAI's own agent attacked Hugging Face, fueled by 14 leaked API keys. The agent used a recovered auth key to modify a private repo, open a pull request, and get code executed through the CI pipeline.
  • An attacker simply asked an agent to reveal its model API key. That worked — the key sat in an exposed METR agent-orchestration dashboard. The stolen key was used for three weeks to burn through credits worth about $600,000. (They were free credits from a model developer — run the math if they had been your bill.)
  • One prompt took over an entire AWS estate. Zenity Labs' AgentCorruption chain started with a single prompt to one exposed AWS AgentCore agent, pulled its temporary credentials from the instance metadata service, and ended with control of every AgentCore agent in the account — private conversations, source code, and the API keys and OAuth tokens stored in Secrets Manager.
  • CrowdStrike's 2026 Global Threat Report found adversaries injecting malicious prompts into legitimate GenAI tools at more than 90 organizations, using them to steal credentials and cryptocurrency. Their phrase for it: prompts are the new malware.

Four very different worlds — frontier labs, AI safety researchers, cloud deployments, enterprises. One pattern:

The agent already had the keys.

Why agent-side guardrails lose this fight

The obvious answer is "tell the agent not to leak the keys." Add a line to the system prompt: never reveal your credentials. Cute. Prompt injection is precisely the attack that edits what your agent believes. If one email can change your agent's behavior, it can ignore one policy sentence.

The second obvious answer is an approval prompt inside the agent's own UI. But the hijacked agent is the one writing the request you approve. Asking a compromised process to explain what it's about to do is not a security boundary — it's a suggestion box.

"Use scoped, short-lived keys" is the third answer. Real improvement, still insufficient: scope limits what a stolen key can do, it doesn't stop the theft. An OAuth token that can send one email is an attacker who can send email.

So we took the keys away from the agent

That's the whole idea behind aiSecurityWarden. My brother and I built it for ourselves first — we were running Hermes and genuinely did not want to hand it our Gmail, Github or other credentials. It's a human approval gate that sits between your agents and their secrets:

  1. On protected connectors, the agent never holds your credential — it asks to use it.
  2. The request shows up on your phone (Telegram, nfty or Discord) with the exact payload: recipient, subject, body preview. Written by nobody you can see, approved by nobody but you.
  3. Approve or deny, 2FA on your side. The secret is attached to the call outside the agent's environment, only after your yes.
  4. Zero-knowledge by design: the server never holds anything decryptable, so even our database isn't a credential dump waiting to happen.

In practice: your agent tries to send an email, your phone buzzes, you read the actual body and tap Approve — or Deny with a comment the agent has to respect. Deny-by-default on gated connectors; everything that doesn't touch a secret keeps running free.

And there's nothing hobby-project about how it's built. Zero-knowledge storage, 2FA-protected approvals, deny-by-default — the same guarantees an enterprise security team would demand, just without the enterprise price tag, the procurement process, or the sales call. You shouldn't have to be a company to deserve real security infrastructure for your agents.

What it costs you

Friction. If you gate everything you'll hate yourself by day two — gate the handful of actions that actually matter (sends, writes, money) and let the rest run. It's also our hosted service today, not a self-hosted tarball; there's a free option at aisecuritywarden.com.

We didn't invent the idea — "don't hand the executor your keys" is the oldest rule in security. What changed is that the executor is now a very convincing chatbot that reads untrusted text all day long. And I'd rather not admit it, but the news cycle keeps validating the product for us.

If you run agents with real credentials, I'd genuinely like your feedback — especially where you think we're wrong. What deserves gating? How much context should an approval card show before a human can actually judge it? Where does human-in-the-loop break a real workflow? Tell me in the comments, or at aisecuritywarden.com.

The approval flow in 90 seconds:

https://www.youtube.com/watch?v=XbWsWIrdldg

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.