The Credential Problem Behind Agentic AI

Wait 5 sec.

On July 16, Hugging Face disclosed a breach with a detail worth sitting with: the intrusion was "driven, end to end, by an autonomous AI agent system," executing thousands of actions across a swarm of short-lived sandboxes over a weekend. A malicious dataset abused two code-execution paths, and from there the attacking agent "harvested cloud and cluster credentials" and moved laterally through internal clusters. There is even a dark-comedy subplot: Hugging Face's own defensive LLM requests were blocked by provider safety guardrails that "cannot distinguish an incident responder from an attacker," while the attacker's agent was bound by no usage policy at all. The defenders ended up running an open-weight model on their own infrastructure to fight back.Most of the commentary has been about the attacker. I keep looking at the prize. The moment that turned an exploit into a breach was credential harvest. It usually is.Here is my position after running AI agents against real business systems every day: an agent cannot keep a secret. Not "might mishandle one." Cannot, structurally. To a language model, an API key in context is just tokens, carrying no special type, no privilege bit, no taboo. Whatever enters the context window can exit through anything the model writes: a log line, a commit message, a helpful explanation, a tool call, a memory file. I have argued before that the context window is a poor place to store facts you care about. It is a far worse place to store keys.The data says this is not hypothetical. GitGuardian's State of Secrets Sprawl 2026 counted 28.65 million new hardcoded secrets in public GitHub commits in 2025, up 34 percent year over year, the largest single-year jump they have recorded. The pointed stat inside that report: commits assisted by Claude Code showed a 3.2 percent secret-leak rate against a 1.5 percent baseline across all public commits. The tools that write more of our code are, today, more than twice as likely to hardcode a credential into it.The supply chain multiplies the exposure. Agent skill marketplaces exploded to more than 40,000 listings within months, and recent scanner-evasion research showed packed malicious skills sailing past every marketplace scanner more than 90 percent of the time. Snyk's ToxicSkills audit found hardcoded secrets sitting in 10.9 percent of the skills it analyzed on one popular hub. And OWASP's state-of-agentic-security report maps prompt injection to six of the ten categories in its agentic Top 10. Put plainly: a skill you install can read what your agent can read, and your agent can be talked into reading things out loud.HackerNoon has covered the enterprise altitude of this well recently, from the plumbing around the model being the real target to agents quietly outrunning corporate access rules. What I have not seen written down is what a working setup looks like for an individual operator. Mine has four moving parts, and none of them require enterprise anything.Reference, resolve, scope, wrap1. Files hold references, never values. Every config that needs a credential gets a pointer instead, in my case 1Password reference URIs that look like op://VaultName/ItemName/field. The MCP server config, the environment blocks, the automation settings: all references. The real config file is gitignored; the committed template contains only pointers. If the repo leaks, it leaks addresses, not keys. There is nothing to rotate after an accidental push, because there is nothing in the push.2. References resolve at process start. The agent CLI launches under the secret manager (op run -- claude, or the equivalent for your stack). At spawn, references materialize into environment variables that live in process memory for the life of the session and are never written to disk. The model sees that a tool works. It does not see why.3. Unattended jobs get a scoped identity. Anything that runs on a schedule authenticates with a service account that can read exactly one vault, read-only. My personal vaults are structurally unreachable from it, not merely unread. Granting an automation a new secret means a human deliberately copies that secret into the agent-facing vault. That copy step looks like busywork. It is actually an approval gate, and I have declined at that gate more than once.4. Tool servers wrap their own resolution. A tool server that needs its own key gets a three-line wrapper: resolve the reference, then exec the real binary. The agent process never holds that credential in any form, resolved or not.#!/bin/bash# No secret lives in this file, only a reference.export SERVICE_API_KEY="$(op read 'op://Agent Vault/Service API/credential')"exec /path/to/mcp-server "$@"The industry is converging on the same principle one abstraction up. 1Password's Credential Broker, in private beta since June, is "a trusted intermediary between an actor that needs a credential and the system where that credential is stored." The open-source Infisical agent-vault does it as an HTTP proxy: the agent makes API calls with dummy placeholder credentials, and the proxy swaps in real ones on the way out. Different implementations, one idea. The model never touches the value.Two operating rules ride on top of the architecture. First, any secret that has ever entered a model's context is published; rotate it, without debate, including the key you pasted "just to test something" three weeks ago. Second, tokens are read-only and least-privilege by default, and a write-capable token is an exception that needs a stated reason.What this does not fixThere is also the other half. The Hugging Face attacker did not need to exfiltrate keys to a pastebin to do damage. It used them. An agent holding a resolved capability can misuse that capability without ever displaying the secret, and if a prompt injection hijacks your agent, reference-based credentials will not save the data that agent can legitimately reach. Architecture stops leak-by-chattiness and leak-by-commit. It does not stop authorized action in a bad cause. For that you need the boring guardrails that limit blast radius: drafts instead of sends, spending that requires a human yes, snapshots before anything destructive, and scopes so narrow that a hijacked agent is mostly a disappointed one. That layering is the actual lesson of July. Credential hygiene is not one control; it is a bet that every individual control will eventually fail, arranged so that no single failure is interesting.You cannot teach a language model to keep a secret. You can build a world where it never learns one.