hermes - 💡(How to fix) Fix Support Anthropic Workload Identity Federation (WIF) as a native auth method [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#20078Fetched 2026-05-06 06:38:53
View on GitHub
Comments
0
Participants
1
Timeline
6
Reactions
0
Participants
Timeline (top)
labeled ×6

Anthropic has released Workload Identity Federation (WIF) — a keyless authentication method that replaces static sk-ant-... API keys with short-lived tokens derived from external OIDC identity providers (AWS IAM, GCP, GitHub Actions, Kubernetes, Microsoft Entra ID, Okta, etc.).

Error Message

resolve_anthropic_token() could detect and report when federation env vars are present (even if the actual exchange is SDK-managed), so error messages and hermes login / hermes doctor can inform users which auth method is active. The WIF docs explicitly warn that ANTHROPIC_API_KEY shadows federation silently (it sits higher in SDK precedence). We could add a warning in hermes doctor or startup when both ANTHROPIC_API_KEY and ANTHROPIC_FEDERATION_RULE_ID are set simultaneously — this is almost always a misconfiguration.

Root Cause

Anthropic has released Workload Identity Federation (WIF) — a keyless authentication method that replaces static sk-ant-... API keys with short-lived tokens derived from external OIDC identity providers (AWS IAM, GCP, GitHub Actions, Kubernetes, Microsoft Entra ID, Okta, etc.).

RAW_BUFFERClick to expand / collapse

Summary

Anthropic has released Workload Identity Federation (WIF) — a keyless authentication method that replaces static sk-ant-... API keys with short-lived tokens derived from external OIDC identity providers (AWS IAM, GCP, GitHub Actions, Kubernetes, Microsoft Entra ID, Okta, etc.).

Current State (Already Working)

Our existing code transparently handles WIF-minted tokens with no changes needed:

  1. Token detection_is_oauth_token() in agent/anthropic_adapter.py already matches sk-ant-oat01-... tokens (WIF output) via the key.startswith("sk-ant-") check, routing them to Bearer auth correctly.
  2. Environment inheritance — When spawning Claude Code via --acp, copilot_acp_client.py does os.environ.copy(), so WIF env vars (ANTHROPIC_FEDERATION_RULE_ID, ANTHROPIC_IDENTITY_TOKEN_FILE, etc.) flow through automatically.
  3. SDK-level handling — If users set WIF env vars and do NOT set ANTHROPIC_API_KEY, the Anthropic Python SDK handles the token exchange internally before Hermes ever sees the credential.

Proposed Enhancements (Nice-to-Have)

1. hermes doctor awareness of WIF env vars

Add WIF-related env vars to the doctor checks so users get clear feedback when federation is configured:

  • ANTHROPIC_FEDERATION_RULE_ID
  • ANTHROPIC_ORGANIZATION_ID
  • ANTHROPIC_SERVICE_ACCOUNT_ID
  • ANTHROPIC_IDENTITY_TOKEN_FILE

2. Document WIF as an auth option in claude-code skill

Add a section to the Prerequisites noting that WIF is an alternative to API keys/OAuth for server-side and CI/CD deployments.

3. Auth status reporting

resolve_anthropic_token() could detect and report when federation env vars are present (even if the actual exchange is SDK-managed), so error messages and hermes login / hermes doctor can inform users which auth method is active.

4. Credential precedence warning

The WIF docs explicitly warn that ANTHROPIC_API_KEY shadows federation silently (it sits higher in SDK precedence). We could add a warning in hermes doctor or startup when both ANTHROPIC_API_KEY and ANTHROPIC_FEDERATION_RULE_ID are set simultaneously — this is almost always a misconfiguration.

5. Native token exchange (optional, low priority)

Currently the Anthropic SDK handles the POST /v1/oauth/token exchange. We could add our own exchange logic in anthropic_adapter.py for environments where the SDK is not installed or where we want finer control over token refresh. This would mirror our existing OAuth refresh logic for Claude Code credentials.

How WIF Works (Reference)

  1. Workload obtains a JWT from its identity provider (ambient on most platforms)
  2. SDK exchanges the JWT at POST /v1/oauth/token using RFC 7523 jwt-bearer grant
  3. Anthropic validates claims against federation rules configured in the Console
  4. Returns sk-ant-oat01-... short-lived token (60s–86400s, default 1h)
  5. SDK caches + auto-refreshes before expiry

Key env vars for zero-argument SDK construction:

  • ANTHROPIC_FEDERATION_RULE_ID — which federation rule to match (fdrl_...)
  • ANTHROPIC_ORGANIZATION_ID — org UUID
  • ANTHROPIC_SERVICE_ACCOUNT_ID — service account (svac_...)
  • ANTHROPIC_IDENTITY_TOKEN_FILE — path to the JWT file

Priority

Low — this is a forward-looking enhancement. WIF is an enterprise/server-side feature primarily useful for CI/CD pipelines and Kubernetes deployments. The current passthrough behavior works correctly without any code changes.

extent analysis

TL;DR

To enhance the existing code for better support of Workload Identity Federation (WIF), implement checks for WIF-related environment variables in hermes doctor and document WIF as an authentication option.

Guidance

  • Add WIF-related environment variables (ANTHROPIC_FEDERATION_RULE_ID, ANTHROPIC_ORGANIZATION_ID, ANTHROPIC_SERVICE_ACCOUNT_ID, ANTHROPIC_IDENTITY_TOKEN_FILE) to the checks in hermes doctor to provide clear feedback when federation is configured.
  • Document WIF as an alternative authentication method in the claude-code skill prerequisites for server-side and CI/CD deployments.
  • Consider adding a warning in hermes doctor or at startup when both ANTHROPIC_API_KEY and ANTHROPIC_FEDERATION_RULE_ID are set, as this is typically a misconfiguration.
  • Review the priority of implementing native token exchange logic in anthropic_adapter.py, as it is currently low priority and the Anthropic SDK handles this exchange.

Example

No specific code example is provided due to the nature of the enhancements being more about awareness and documentation rather than code changes.

Notes

The enhancements proposed are considered low priority since the current implementation already works correctly with WIF without needing code changes. The focus is on improving user experience and providing clearer feedback and documentation.

Recommendation

Apply the proposed enhancements, starting with adding WIF checks to hermes doctor and documenting WIF as an authentication option, to improve user experience and clarity around authentication methods.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix Support Anthropic Workload Identity Federation (WIF) as a native auth method [1 participants]