Your AI Agents Don't Need Secrets: Workload Identity Federation for the Agent Era
Every production AI agent built in the last two years acquired a quiet collection of static credentials: an OpenAI key, an AWS access key pair, a service-account JSON, a Slack bot token, an MCP server client secret. Each one is a permanent liability that an attacker can use the moment it leaks — as the wfx-loot campaign demonstrated against 61,764 repositories this month, and GitBook and WorkOS demonstrated against B2B SaaS. There is a cleaner answer that security and platform teams have been shipping, piece by piece, since well before agents arrived: workload identity federation. Agents do not need secrets. They need a cryptographic, short-lived, verifiable identity.
TL;DR
- · The problem: every AI agent in production is carrying static API keys. The shape of every 2026 breach reads like a tour of the resulting non-human identity inventory.
- · The pattern: workload identity federation (WIF) + OIDC. The agent proves what it is to its own platform (K8s, AWS, Azure, GCP, a signed OIDC issuer); the resource provider accepts that proof and issues a short-lived credential bound to a specific request context.
- · The guardrails: narrow the OIDC subject claim to repo + branch + workflow + environment; set credential TTLs in minutes; map tool-level scopes per agent identity; log every exchange.
- · The provider gap: frontier LLM providers (OpenAI, Anthropic, Gemini) are still API-key-only. Proxy them through your own gateway that holds one tightly-scoped key in a vault and issues your agents short-lived gateway tokens via WIF.
- · The payoff: a stolen credential is worth minutes, not forever. The next GhostAction-shape leak becomes a nuisance, not an incident.
The static-secret stack every agent inherits
Walk through a typical agent-in-production's environment and list the long-lived credentials it holds. For a well-built LangGraph / LlamaIndex / OpenAI Agents SDK / custom agent, the list is unpleasant:
- LLM-provider API keys — OpenAI
sk-*, Anthropic, Google, AWS Bedrock-via-access-key, Azure OpenAI. - Cloud credentials — long-lived AWS access keys, GCP service-account JSON, Azure service-principal client secrets.
- Integration tokens — Slack bot tokens, Jira / Linear / Notion API keys, Zapier secrets, GitHub PATs.
- MCP server credentials — client secrets issued when the agent first connected to a Model Context Protocol server, usually with scopes broader than any single tool call needs.
- Internal API keys — the organisation's own services, often minted as static tokens because "the agent is internal."
- Database and vault credentials — direct DB users for RAG stores, Vault AppRole secrets for retrieval systems.
Each of these is a permanent credential that the agent reads from an environment variable, a config file, or a secrets manager. Each is reachable from inside the agent's process. Each has no notion of the request context it was issued against — if it leaks, it is equally usable from the attacker's laptop as from the agent's container.
Why rotation isn't the answer alone
Rotation closes the forward door. It does not close the backward one. The empirical evidence from 2026:
- October's GhostAction incident dumped a large pool of GitHub Personal Access Tokens, OAuth refresh tokens, and account session cookies. Everything not rotated in the following four weeks was still exploitable.
- November's wfx-loot campaign used that pool against 61,764 repositories, injected a stealer into at least 1,835, and read every secret the CI job touched from the runner's own process memory — including secrets the attacker's step never declared. Rotation at the step level did not help; the whole job was the exposure unit.
- Infostealers on developer workstations continue to scrape
git-credential-managercaches, keychains, and browser cookies. Logs sell on criminal marketplaces for pennies per record.
Rotation is necessary — nobody would argue otherwise. But a rotation cadence of N days leaves N days of window on every leaked credential. The only operational way to shrink that window to minutes is to stop issuing credentials with lifetimes measured in anything bigger.
The alternative: workload identity federation
The idea, in four moves:
- Every workload that runs — a Kubernetes pod, an AWS Lambda, an Azure container app, a GitHub Actions job, a GCP Cloud Run service, a VM with an instance profile — gets an identity from its platform. The platform signs an OIDC token that attests to what the workload is: its service account, its namespace, its repo/branch, its deployment context.
- The resource provider — the one holding the thing the agent wants — publishes an OIDC trust relationship with the workload's platform. "I will accept tokens signed by
https://token.actions.githubusercontent.comwhosesubclaim isrepo:acme/retrieval-agent:environment:prod." - The agent exchanges its platform-signed token with the resource provider for a short-lived credential scoped to the specific operation. AWS STS returns 15-minute temporary creds. GCP returns an access token valid for an hour. Azure returns an access token with a configurable TTL.
- The resource provider verifies the signature and the subject claim on every call, independently. Nothing is stored. The next request repeats the cycle.
Three properties follow directly: there is nothing durable to steal; stolen tokens are useful for minutes at most; the token is cryptographically bound to the context that minted it, so an attacker who grabs it cannot replay from a different workload identity.
Cloud-by-cloud: what this looks like in practice
AWS — STS AssumeRoleWithWebIdentity + OIDC
Register an OIDC identity provider for the agent's platform (GitHub Actions, EKS pod OIDC, external IdP). Create an IAM role with a trust policy pinned to the exact sub claim the workload emits. The agent calls sts:AssumeRoleWithWebIdentity with its platform JWT and gets back a 15-minute AWS session. For agents running on EKS, IAM Roles for Service Accounts (IRSA) or EKS Pod Identity handles the exchange automatically. For agents using Bedrock, bind the role to specific model ARNs and a tight invocation budget. No long-lived access key ever touches the agent.
GCP — Workload Identity Federation + service account impersonation
Create a Workload Identity Pool with an OIDC provider that trusts the agent's platform. Grant the external identity permission to impersonate a GCP service account (roles/iam.workloadIdentityUser). The agent calls iamcredentials.generateAccessToken and receives a short-lived service-account token. For agents running on GKE, GKE Workload Identity handles the exchange at the pod level. For Vertex AI access, bind the impersonated service account to specific publisher models and quota-per-project.
Azure — Federated Identity Credentials + managed identities
Add a federated identity credential to an Azure AD application with an issuer and subject that match the agent's platform (GitHub Actions, AKS workload identity, external OIDC IdP). The agent's platform JWT is accepted directly as proof; ClientAssertionCredential exchanges it for an Azure access token. For agents on AKS, Azure AD Workload Identity for Kubernetes handles it automatically. Azure OpenAI, Key Vault, and Cosmos DB all accept the resulting tokens via standard Entra RBAC.
Multi-cloud — SPIFFE / SPIRE as the lingua franca
If your agent estate spans clouds, SPIFFE (Secure Production Identity Framework For Everyone) and SPIRE (its reference runtime) give each workload a SPIFFE ID — a cryptographically verifiable identity portable across environments. SPIRE issues short-lived X.509 SVIDs (certificates) or JWT SVIDs (tokens) that AWS, GCP, Azure, Vault, and your own services can all accept as workload identity sources. The practical payoff: one identity model, N cloud trust relationships.
What about OpenAI, Anthropic, Gemini — the API-key-only providers?
The frontier LLM providers still ship API-key authentication only. There is no OIDC trust relationship with api.openai.com today. The pragmatic bridge:
- Gateway pattern. Run an LLM gateway (LiteLLM, your own) that holds the long-lived provider key in a vault. Agents authenticate to the gateway via WIF and receive a short-lived gateway token that the gateway exchanges for a provider call under its own key. The provider key is now a single, high-sensitivity NHI in your vault — not a scatter of keys across every agent.
- Per-agent gateway tokens. The gateway issues tokens bound to the agent's platform identity, with per-agent spend caps, model allow-lists, and TTLs in minutes.
- Cloud-managed equivalents. Where you can use them, AWS Bedrock, Azure OpenAI, and Vertex AI already accept your cloud workload identity directly — no provider API key needed anywhere.
See our how-to-stop-LLMjacking controls checklist for the operational side of this (budget caps, anomaly detection, gateway logging).
Pin the subject claim — this is where most WIF deployments fail
Workload identity federation gives you a cryptographic token that says "I am X." The whole security story depends on what X is. Common misconfigurations we see:
- Too-broad subject claim. AWS role trusts
repo:acme/*. Any repo in the org can now mint cloud credentials against that role. Attackers who compromise any repo in the org (see wfx-loot) get those creds. - Missing environment pin. Trust claim is
repo:acme/retrieval-agent:*. A PR from an attacker-controlled branch can now mint prod cloud credentials. Pin torepo:acme/retrieval-agent:environment:prod(GitHub Actions environment binding) or the equivalent on your platform. - Missing workflow pin. Trust accepts any workflow in the repo. Pin to the specific workflow file name as part of the subject.
- Over-broad target role. The role on the resource side grants
bedrock:*ors3:*. Scope down to specific model ARNs, specific bucket prefixes, specific API operations. - Long TTL. Credential lifetime is 12 hours "because that's easier." Shorten to 15 minutes; configure the client to refresh. If refresh is painful, that is the client doing the right thing.
MCP servers and the per-tool scope
The Model Context Protocol surface is where the newest version of this problem lives. Each MCP server is effectively a workload identity that holds credentials for downstream systems (GitHub, Jira, Slack, your databases). Treat it accordingly: issue the MCP server its own federated identity; have agent clients authenticate to the MCP server via WIF; bind each client's token to a per-tool allow-list so "this agent can call github.create_issue and github.read_issue, at most N times per minute, in this one repo." A stolen MCP client token then exposes those specific tools, not every tool on every connected MCP server.
For broader prompt / tool / skill integrity controls, see our prompt and skills integrity guide.
The migration path
You do not rip and replace a credential estate in one sprint. The pragmatic sequence:
- Inventory first. Every agent, every credential it holds, owner, lifetime, last rotation, provider cap. You cannot migrate what you cannot enumerate.
- Pick one high-value path to federate. Usually: the agent's cloud identity. A new agent can start WIF-native; an existing agent can be dual-run with WIF added before the static key is removed.
- Introduce the gateway for frontier LLM providers. One shared gateway + short-lived per-agent tokens replaces the per-agent OpenAI/Anthropic key scatter.
- Migrate MCP clients. Each MCP integration should be the second-fastest thing to federate because the surface is small and the per-tool scope story is already in the spec.
- Narrow subject claims and TTLs iteratively. Deploy with modest TTLs first, tighten over a few weeks as refresh failures get caught in staging.
- Retire the static keys as agents prove out. Alert when a credential is unused for 30 days — most migrated agents' legacy keys will fall into this bucket cleanly.
Compliance mapping
- ISO/IEC 42001 — Annex A.8.3 (credential lifecycle), A.6.4 (access control for AI components). WIF is the shortest path to compliant evidence.
- NIST AI RMF — Manage 2.2 (credential-management discipline), Govern 1.2 (access decisions).
- EN 18286 — §6.4.3 (credential lifecycle management) specifically rewards non-stored, short-lived patterns.
- SOC 2 — CC6.1 (logical access) and CC7.3 (anomaly detection). Short-lived, logged, context-bound credentials make both controls far easier to evidence.
- PCI DSS 4.0 — Requirement 8.3.10.1 explicitly requires that credentials used by non-human identities be either short-lived or rotated on documented triggers. WIF satisfies both halves.
- Google ISO 27001 / Azure/AWS compliance — all major cloud providers' control sets now explicitly cite federated workload identity as the preferred alternative to static keys.
How TigerGate helps
- AI-SPM enumerates every agent, model, gateway, and MCP server across your repos, images, clouds, and runtime — and flags the ones still carrying long-lived provider or cloud credentials. One dashboard, every non-human identity.
- Identity Security (CIEM) surfaces every IAM role, service account, and federated identity each agent holds; flags over-broad OIDC subject claims and over-long TTLs; and watches for the behavioural anomalies that catch WIF misconfigurations in production — idle credentials reactivating, roles accessing secrets they never touched before, tokens appearing from new source IPs.
- Code Security & Secrets Scanning catches AI-provider keys, cloud creds, and MCP client secrets leaking into source, container images, or CI logs — the credential-theft side of every incident this guide is a reaction to.
- CSPM validates OIDC trust-policy posture on AWS, GCP, Azure: wildcard subject claims, missing environment pins, over-broad target-role permissions, and TTLs out of policy.
- eBPF runtime detection watches the exchange surface in practice — anomalous volumes of
sts:AssumeRoleWithWebIdentity, unusualgenerateAccessTokenpatterns, federated-identity usage outside normal workload hours. - Compliance evidence maps your WIF rollout to the clauses above and produces audit-ready evidence.
FAQ
Related reading
- wfx-loot — the credential-reuse campaign this post is a response to
- How to stop LLMjacking — API-key hygiene, provider budgets, gateway logging
- AI Agent Security Checklist — the five-gate program this control set lives inside
- Prompt & skills integrity guide — the configuration-supply-chain companion to identity hygiene
Audit your agent estate for static secrets in 14 days
TigerGate inventories every agent, every MCP server, every AI-provider key, every cloud role — and tells you which of them are still issuing long-lived credentials in a workload-identity-federation world. One connector install; first findings in the dashboard inside an hour.