feat: add Anthropic WIF : Workload Identity Federation auth#20073
feat: add Anthropic WIF : Workload Identity Federation auth#20073leprincep35700 wants to merge 1 commit into
Conversation
42ed79f to
0d0434f
Compare
39019cc to
a1d96a3
Compare
|
Small follow-up after reviewing the PR from a maintainer-readability angle:
If maintainers want to test this against an Anthropic WIF setup, please ask me — I can share the safe GitHub Actions workflow shape and the exact issuer/audience/subject checks without exposing tokens or secrets. |
|
Validation update on the Anthropic WIF PR:
What is now proven by the live run:
What still fails:
So the original route-propagation bug was real and is now fixed locally, but there is still at least one more runtime-resolution / repeated-WIF-resolution issue left in the live CLI path before I can honestly call Hermes chat fully green end-to-end. I’m leaving this update here so reviewers can see the exact validated boundary:
|
|
Quick status update from my side: I moved this PR back to draft because I spent real Anthropic credits to test it end to end, and I want to keep the review state honest until the final Hermes CLI path is fully green. What is validated so far:
What I just pushed:
Why this change:
Targeted verification I ran locally:
I am keeping it in draft until I rerun the live GitHub Actions WIF workflow and confirm the final |
|
Final update: I’m moving this PR back to ready for review. I validated the Anthropic WIF path end to end with a live GitHub Actions OIDC run using real Anthropic credits. The validation covered the previously failing CLI path, including I also removed the temporary diagnostic workflow/run artifacts from my fork after validation so the PR does not depend on public diagnostic logs. Targeted local validation passes:
Result: The WIF implementation has now been validated from auth setup through an actual One note for reviewers: the PR branch still shows a general upstream |
|
Quick status clarification after rebasing/updating this PR against the current upstream
I do not want to overclaim this as full green CI while that broad job is red. I checked recent upstream/main and other open PR runs, and the same broad-suite failure families are showing up outside this WIF branch too (cron MCP init, gateway platform config, browser Chromium checks, delegate heartbeat timing, credential-pool env fallback, sandbox cwd assertions, etc.). That makes this look like current upstream-wide CI noise rather than a WIF-specific failure. So the intended review posture is:
|
|
Hi @teknium1, sorry for the ping — this PR adds Anthropic WIF as an opt-in auth mode. Targeted WIF validation is green, and the remaining broad test failure appears to match current upstream CI noise. Would you be the right person to review the auth/provider shape, or should I route it elsewhere? |
7067ad9 to
fbfdd23
Compare
7e7253c to
81ae5e5
Compare
81ae5e5 to
67477f0
Compare
|
Branch refreshed onto current
Total targeted local validation rerun: |
|
Current-main reassessment: I rechecked this against current Conclusion: the feature remains useful, but this branch should not be merged as-is. What current main still lacks:
Current update status:
Recommendation:
|
cf2141f to
089a89a
Compare
|
Rebased onto current
|
089a89a to
020d06d
Compare
020d06d to
6191eef
Compare
Summary
I added Anthropic Workload Identity Federation (WIF) support as a first-class auth mode on the existing
anthropicprovider.This keeps Hermes' provider model unchanged (
provider=anthropic) while allowing Anthropic credentials to be resolved from a short-lived OIDC workload identity token instead of a static API key.What changed
hermes auth add anthropic --type wif.x-api-key.ANTHROPIC_API_KEYvalues, so a stale local API key cannot silently override a configured WIF setup.hermes autheven though it is provider-state-backed rather than credential-pool-backed.hermes auth remove anthropic anthropic-wif/ indexed removal to remove the WIF configuration cleanly.Why this shape
Anthropic WIF is not a separate model provider. It is another way to obtain Anthropic credentials. For that reason I kept the runtime on the existing Anthropic Messages path and made WIF an auth type under
anthropic.The exchanged Anthropic token is short-lived and should not be treated like a static API key or stored in the credential pool. Hermes stores the federation configuration and resolves/exchanges the token when needed.
Existing Anthropic API-key and OAuth setups continue to work unchanged. WIF is opt-in through the new Anthropic auth choice /
--type wifpath.If a long-running Hermes process needs to rebuild the Anthropic client or re-resolve credentials, the runtime preserves forced Bearer/WIF semantics instead of falling back to API-key semantics.
Testing / verification
Latest local verification after replaying this branch cleanly on current upstream
main(26933c2f5) and force-pushing the refreshed PR head (fbfdd237a):Result:
GitHub checks are running on the refreshed head. I am not claiming full green CI until those complete.
Live WIF validation
I validated the real WIF path with a private GitHub Actions workflow on my fork using GitHub Actions OIDC as the identity provider:
The validation covered the previously problematic
hermes chatpath after the runtime fixes. Temporary diagnostic workflow/run artifacts were removed from my fork after validation so the PR does not depend on public diagnostic logs.Notes for maintainers
This implementation follows Anthropic/Claude's Workload Identity Federation model as documented in the Claude Code IAM documentation and the Anthropic OAuth token exchange API docs:
If you want to reproduce the live WIF test, you need an Anthropic organization with Workload Identity Federation enabled and a federation rule configured for your OIDC issuer.
For GitHub Actions OIDC, the important pieces are:
permissions: id-token: writein the workflowhttps://token.actions.githubusercontent.comanthropicrepo:<owner>/<repo>:ref:refs/heads/main, orrepo:<owner>/<repo>:*identity_token_fileThe identity token file must contain the runtime OIDC JWT. It should not be a workflow YAML file and it should never be committed or printed in logs.
If there are any questions about testing this end-to-end or about setting up the Anthropic/Claude-side WIF credential, please ask me. I can share the exact safe test workflow shape and the expected issuer/audience/subject checks without exposing tokens or secrets.
Security considerations
Current status
Ready for review on the WIF/auth/runtime implementation.
I replayed the PR cleanly on current upstream
main, force-pushed the cleaned branch tofeat/anthropic-wif-auth, and verified the targeted WIF/auth/runtime suite locally with an isolatedHERMES_HOMEso the test run does not touch the live Hermes state database. GitHub checks are running on the refreshed head; I am not claiming full green CI until those finish.This work was done with Hermes Agent.