Security · ~7 min
A static API key on an agent runtime is the highest-blast-radius credential you can hold — leakable from logs, hooks, and transcripts, with rotation that never matches an incident. Federation removes the key entirely.
A static sk-ant-... key works until manual rotation, from any network an attacker
controls. Workload Identity Federation (WIF) removes it: the workload presents a signed OIDC JWT from an identity
provider it already runs inside, and the provider mints a short-lived token bound to a service account.
A leaked federated token expires in minutes.
| Resource | Role |
|---|---|
Federation issuer (fdis_…) | Registers an OIDC provider URL + JWKS source |
Service account (svac_…) | The non-human identity the minted token acts as |
Federation rule (fdrl_…) | "When a JWT from issuer X has claims Y, mint a token for account Z, scope S" |
The workload presents its IdP-issued JWT via the RFC 7523 jwt-bearer grant; the provider verifies the
signature against the registered JWKS, matches claims against the rule, and returns a scoped, short-lived token.
Pin subject_prefix to a single repo and protected branch; always set audience on both the
rule and the token projection; prefer static matchers over CEL; and unset, do not blank, any leftover
ANTHROPIC_API_KEY — it outranks federation even when empty. Confirm with ant auth status.
The minted token's lifetime is capped at 2 × JWT_remaining, so the federated token can never outlive
the upstream identity it was derived from. That's the structural win: a leaked token is useless in minutes.
Token exchange verifies the JWT signature and matches its claims — but does not attest that the workload presenting the token is the one it claims to be. A service account scoped too broadly means WIF "will faithfully mint a valid token for the wrong workload." Treat WIF as authentication for one destination, not a substitute for an attested workload-identity program.
And it isn't always worth the complexity. A small team on a single fixed host can match the blast-radius reduction with vault-rotated keys via a wrapper script (Lesson 3). WIF earns its three extra resources only when the runtime already has an ambient workload identity — a Kubernetes service account, AWS IRSA, GitHub Actions OIDC — shared across multiple workloads.
Retrieval practice — recall, don't peek
Question 1Workload Identity Federation replaces a static API key with…
Question 2Under WIF, the security boundary is now the…
Question 3A leftover ANTHROPIC_API_KEY="" is dangerous because it…
Question 4WIF still leaves open the…
Question 5 · spaced recall from Lesson 11Why does an injected prompt fail to bypass the control plane?