Skip to content

fix: add client_credentials fallback for outbound token acquisition#152

Closed
mrsabath wants to merge 1 commit into
rossoctl:mainfrom
mrsabath:fix/go-processor-client-credentials-fallback
Closed

fix: add client_credentials fallback for outbound token acquisition#152
mrsabath wants to merge 1 commit into
rossoctl:mainfrom
mrsabath:fix/go-processor-client-credentials-fallback

Conversation

@mrsabath

Copy link
Copy Markdown
Contributor

Summary

  • The go-processor's outbound handler only supported RFC 8693 token exchange, which requires a valid subject_token from the outbound request's Authorization header
  • When agents don't forward inbound tokens on outbound MCP requests (or forward invalid ones), the exchange fails and the tool receives no authentication
  • Adds a clientCredentialsGrant() fallback: the outbound handler tries token exchange first, then falls back to OAuth 2.0 client_credentials grant using the agent's registered SPIFFE ID client credentials
  • Verified end-to-end with the GitHub Issue Agent demo on the kagenti realm

Context

Discovered during end-to-end testing of the realm migration (rossoctl/rossoctl#767). The git-issue-agent does not forward the inbound JWT on its outbound MCP requests to the GitHub tool. The go-processor saw no Authorization header and skipped token acquisition entirely, causing the tool to call GitHub's API without authentication.

The fallback flow is:

  1. Check outbound request for Authorization header
  2. If present: attempt token exchange (existing behavior)
  3. If exchange fails or no header: use client_credentials grant with the agent's SPIFFE ID client
  4. Set the resulting token as the Authorization header on the outbound request

Test plan

  • Deploy updated envoy-with-processor image to Kind cluster
  • Send request to git-issue-agent via CLI test pod
  • Verify inbound JWT validation succeeds (go-processor logs)
  • Verify outbound client_credentials grant succeeds (go-processor logs show [Client Credentials] Successfully obtained token)
  • Verify GitHub tool receives valid token and returns real GitHub issues

Part of: rossoctl/rossoctl#767

Made with Cursor

The go-processor outbound handler only supported token exchange
(RFC 8693) which requires a valid subject_token from the outbound
request Authorization header. When the agent does not forward a
token (or forwards an invalid one), the exchange fails and the
request reaches the tool without authentication.

Add a clientCredentialsGrant() function that obtains a token using
the OAuth 2.0 client_credentials grant as a fallback. The outbound
handler now tries token exchange first, and if that fails (or no
auth header is present), falls back to client_credentials using the
agent registered SPIFFE ID client and secret.

This enables end-to-end AuthBridge flows where agents do not forward
inbound tokens on their outbound MCP requests.

Part of: rossoctl/rossoctl#767

Signed-off-by: Mariusz Sabath <mrsabath@gmail.com>
Made-with: Cursor
@mrsabath

Copy link
Copy Markdown
Contributor Author

/run-e2e

@huang195

Copy link
Copy Markdown
Member

@mrsabath is this going to be a temporary solution? When token exchange fails, and we fall back to the agent's own credentials to perform token exchange, this doesn't sound secure.

@mrsabath
mrsabath marked this pull request as draft February 27, 2026 22:25
@mrsabath

mrsabath commented Mar 9, 2026

Copy link
Copy Markdown
Contributor Author

Closing: superseded by #171 (merged Mar 6), which implemented the same client_credentials fallback for outbound token acquisition.

@mrsabath mrsabath closed this Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants