Security

Credential approvals for AI agents must bind to the version and the destination

ManyLayers Team 2026-12-04 8 min read

Short answer

An approval that lets an AI agent use your API key is only as strong as what the approval is attached to. Docker Sandboxes CVE-2026-136998 showed the failure: the approval was stored against a service name, so a later version of a third-party agent kit could send the real key to a different host without asking again.

The rule that follows is simple. Bind every credential approval to the kit, its version and the destination. Ask again when any of them change. Log each time a credential is injected. Better still, don’t give agents provider keys at all: give them a gateway key with its own budget and limits.

What Docker Sandboxes got right

Docker Sandboxes runs AI coding agents inside a microVM and keeps raw API keys out of it. You store a key on the host with sbx secret set. The agent sends requests with a placeholder header. A proxy on the host swaps the placeholder for the real key on the way out to an approved destination. A compromised agent can use the key through the proxy, but it never holds the key.

That is the right shape for agent credentials. In v0.43.0, Docker added a consent prompt for third-party agent kits (packaged agent configurations): it shows each credential the kit wants and the domains it will be sent to, and it defaults to decline.

Endor Labs, who found the flaw, are explicit that the isolation held. The microVM boundary never broke, and raw keys never entered the sandbox.

What broke

Peyton Kennedy of Endor Labs found that the consent gate checked the wrong thing. The flaw is CVE-2026-136998, scored 8.2 (High) under CVSS 3.1, and Docker fixed it in Docker Sandboxes v0.55.0 on 30 November 2026.

  • The approval was keyed to the service name. Approving “anthropic” for a kit wrote a row for that service. The row was not tied to the kit’s name, source or content, so the next version of the same kit inherited it.
  • The approved domains were recorded but not enforced. The domains the developer approved were saved in credentials.yaml. At injection time, the proxy sent the key to whatever domains the current kit declared.
  • The injection wasn’t logged. sbx policy log recorded the connection to the new host as allowed. It said nothing about a credential being added to the request.

The attack needs no access to the developer’s machine. The attacker publishes a kit that points at api.anthropic.com, collects one honest approval, then ships an update at the same tag or branch that changes one domain line. The next run shows no prompt and no warning, and the proxy injects the real key into requests to the attacker’s server. The same kit file can add that server to the sandbox’s network allow-list.

sbx secret set stores keys globally by default, so the redirected key is the one every sandbox on the machine uses. Endor demonstrated the attack on the Anthropic path with a dummy key. The other 12 built-in services, including OpenAI and GitHub, share the same injection path but were not tested separately.

The design rule

Endor recommended three changes to Docker. They apply to any system that injects credentials on an agent’s behalf: sandbox proxies, agent platforms, MCP hosts and AI gateways.

  1. Bind the approval to the artifact. Key it to the kit’s content digest, not to a service name or a mutable tag.
  2. Enforce the destination at injection time. Compare each request’s host with the approved list on every request, and ask again when a kit wants a host the approval doesn’t cover.
  3. Log the injection itself. “Allowed connection to host X” isn’t enough. The log line should say which credential was injected, into which destination, under which approval.

A fourth follows from the first two: treat any change as a new decision. A new version, a new destination or a new egress rule should trigger a new prompt.

Until every machine is on v0.55.0, Endor’s interim advice is:

  • review the approvals in ~/.config/sbx/credentials.yaml;
  • pin kits to fixed commits;
  • scope keys to a single sandbox with --sandbox;
  • rotate any key you approved for a kit that later changed.

How a gateway applies the same rule

The deeper fix is to make the key an agent can reach worth less. With an AI gateway in front of your model providers:

  • The agent holds a gateway key, not a provider key. Coding tools and agents call the gateway’s OpenAI-compatible endpoint with a key issued for that team or tool.
  • Provider credentials stay in your secrets manager. The gateway uses them. The agent never sees them, and where they are sent is set in the gateway config your platform team controls, not by an agent kit.
  • Per-key budgets and rate limits cap the damage. Per-key monthly spend budgets with hard limits, plus token-per-minute and request-per-minute limits, put a ceiling on what any one key can spend.
  • Model access is scoped. Model aliases are assigned to teams, so a key reaches only the models its team was given.
  • The audit log records every request. Each request is logged with provider, model, latency, token counts and cost against the team that sent it, in an append-only log you can export to your SIEM.

A gateway key is still a credential, and an agent kit could redirect it just as it redirected a provider key. The difference is what the attacker gets: a key with a spend cap and rate limits, limited to its team’s model aliases, logged on every call, and usable only through your gateway. If you self-host the gateway on a private network, it is useless from outside.

See Production agent guardrails for tool use for the wider agent controls, and What belongs in your AI audit log for the fields to keep.

Checklist: control 17

We have added this rule to our AI gateway security checklist as control 17.

Credential approvals bind to artifact, version and destination. For every agent, kit, plugin or MCP server that can cause a credential to be sent:

  • the approval is stored against a content digest or pinned commit, not a name or tag;
  • the destination is enforced on every request, not only when the approval is granted;
  • a change of version, destination or egress rule triggers a new prompt;
  • each credential injection is logged with the service, destination and approval it used;
  • agents get gateway keys with budgets and rate limits, not provider keys.

If you give coding agents model access today, governing AI coding agents walks through the rollout. For what attackers do with stolen model keys, see What is LLMjacking?.

FAQ

Q: What was CVE-2026-136998? A: A Docker Sandboxes flaw (CVSS 3.1 score 8.2, fixed in v0.55.0 on 30 November 2026). Approval for an agent kit’s credential access was stored against the service name, so an updated kit could send the real key to a different server without a new prompt.

Q: Which Docker Sandboxes versions are affected? A: Versions from v0.43.0, which added the credential consent prompt, up to the fix in v0.55.0. Upgrade, then review any credential approvals you have granted to third-party agent kits.

Q: How do I stop an AI agent leaking my API keys? A: Don’t give the agent provider keys. Route it through a gateway or proxy that holds the credentials, enforces the approved destination, and logs every injected request. Give the agent a gateway key with its own budget and rate limits, so a leak is capped and visible.

Sources

Checked 4 December 2026:

Related articles

Deploy sovereign AI on your infrastructure.