Implement upstream_inject strategy and SubjectProviderName#4390
Merged
Implement upstream_inject strategy and SubjectProviderName#4390
Conversation
8050a55 to
0810bda
Compare
76cd569 to
fc12658
Compare
3 tasks
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4390 +/- ##
==========================================
+ Coverage 69.47% 69.49% +0.02%
==========================================
Files 485 486 +1
Lines 49969 50017 +48
==========================================
+ Hits 34715 34760 +45
- Misses 12570 12574 +4
+ Partials 2684 2683 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
tgrunnagle
approved these changes
Mar 26, 2026
jerm-dro
previously approved these changes
Mar 26, 2026
fc12658 to
9f25687
Compare
d1d62a3 to
21a42ec
Compare
9f25687 to
c904405
Compare
tgrunnagle
previously approved these changes
Mar 27, 2026
21a42ec to
62337a2
Compare
8156719 to
dacf7fb
Compare
4 tasks
The base branch was changed.
Phase 2 of RFC-0054: add the upstream_inject outgoing auth strategy that injects per-provider upstream IDP tokens into backend requests, and extend token_exchange to source its subject token from identity.UpstreamTokens when SubjectProviderName is configured. - Add UpstreamTokens stub field to Identity with MarshalJSON redaction - Add UpstreamInjectStrategy (stateless, follows header_injection pattern) - Extend TokenExchangeStrategy to resolve subject token from upstream tokens when SubjectProviderName is set, falling back to identity.Token - Register upstream_inject in the outgoing auth factory Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The anonymous function returning (string, error) obscured control flow without benefit — error returns exit the closure, not the method. Plain if/else is idiomatic and matches the rest of the codebase. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
dacf7fb to
99c8e33
Compare
jerm-dro
approved these changes
Mar 27, 2026
tgrunnagle
approved these changes
Mar 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
upstream_injectneed to receive per-provider upstream IDP tokens. This addsthe runtime strategy and extends
token_exchangeto source its subject tokenfrom upstream tokens when
SubjectProviderNameis configured.UpstreamInjectStrategy(stateless, follows theheader_injectionpattern)that reads from
Identity.UpstreamTokensand sets the Authorization header.TokenExchangeStrategyto resolve the subject token from upstream tokenswhen
SubjectProviderNameis set, falling back toIdentity.Token.handleSpecValidationErrorthat swallowed the status-apply errorand proceeded to
ensureDeploymenteven when the ConfigMap was not created.Fixes #4145
Type of change
Test plan
task test)task lint-fix)Changes
pkg/vmcp/auth/strategies/upstream_inject.goUpstreamInjectStrategy— looks up provider token from identity, sets Bearer headerpkg/vmcp/auth/strategies/upstream_inject_test.gopkg/vmcp/auth/strategies/tokenexchange.goUpstreamTokens[SubjectProviderName]when configuredpkg/vmcp/auth/strategies/tokenexchange_test.goErrUpstreamTokenNotFoundsentinelpkg/vmcp/auth/types/types.goErrUpstreamTokenNotFound,StrategyTypeUpstreamInject,SubjectProviderNamefieldpkg/vmcp/auth/factory/outgoing.goupstream_injectin factorypkg/vmcp/auth/factory/outgoing_test.gocmd/thv-operator/controllers/virtualmcpserver_controller.gohandleSpecValidationErrorto propagate status-apply errors and stop reconciliationSpecial notes for reviewers
ensureVmcpConfigConfigMapreturned aSpecValidationError, the reconciler would swallow a failed status update and then fall through toensureDeploymentwith a potentially stale/missing ConfigMap.🤖 Generated with Claude Code