Repository navigation
Fix vMCP validator for canonical grants, pin key rotation - #7048
Merged
Merged
Conversation
A vMCP config that declares its delegate clients, or its JWT bearer issuer policies, only under inbound_grants was rejected with "requires at least one upstream". The check counted the deprecated top-level delegate_clients list and read the trusted issuers before the canonical JWT bearer policy had been applied to them. The operator hit it too: its checks accept inboundGrants with no upstream providers, then the reconciler ran this validator and marked the VirtualMCPServer Failed. Judge the same normalized view the runtime uses, by running NormalizeInboundGrants once and checking its delegate clients and trusted issuers. Such a config is now accepted. A config with no upstreams and conflicting legacy and canonical grants now fails here with the normalization error instead of at runtime. Co-authored-by: Mecatl <[email protected]>
A private_key_jwt delegate without a token_exchange block is refused since the trust-mode rule landed. Users upgrading from an earlier release may have such a client that relied on the implicit any behaviour, so the error now names the one-line change that restores it. Co-authored-by: Mecatl <[email protected]>
The comment said a key implies its signing algorithm. An RSA key without alg does not imply RS256; RS256 is only the default when the keys do not say, because RS and PS are both possible. Say what the function returns. Co-authored-by: Mecatl <[email protected]>
A broker that rotates its private_key_jwt key needs a window where the server accepts both the old and the new key. The runtime supports that through a multi-key JWKS with unique kids, but the only rotation test replaced one key with another, so the overlap was never exercised. Extend that test to walk old, then old plus new, then new, so it accepts both keys while the file holds both and refuses the old one once it is removed. Document the three-step procedure, why the order matters, and that memory storage drops what the server held across a restart. Co-authored-by: Mecatl <[email protected]>
jhrozek
requested review from
ChrisJBurns,
JAORMX,
amirejaz,
jerm-dro,
rdimitrov and
tgrunnagle
as code owners
November 3, 2026 20:56
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7048 +/- ##
==========================================
- Coverage 80.53% 80.52% -0.02%
==========================================
Files 853 856 +3
Lines 87221 87378 +157
==========================================
+ Hits 70243 70360 +117
- Misses 16973 17013 +40
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
rdimitrov
approved these changes
Nov 4, 2026
rdimitrov
left a comment
Member
There was a problem hiding this comment.
LGTM. The validator now normalizes the same way RunConfig.Validate does at runtime, so the only configs it newly rejects (normalization conflicts, duplicate issuers, bad issuer_refs) already failed at startup. The trust-mode error keeps the old text as a prefix. No breaking changes found.
4 of 11 tasks
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
A vMCP config that declares its delegate clients, or its JWT bearer issuer policies, only under
inbound_grantswas rejected with "requires at least one upstream". The CRD admits that shape and the runtime serves it, but the vMCP validator counted only the deprecated top-leveldelegate_clientslist and read the trusted issuers before the canonical JWT bearer policy had been applied to them. The operator hit it too: its checks acceptinboundGrantswith no upstream providers, then the reconciler ran this validator and marked the VirtualMCPServerFailed.The other commits are small follow-ups from the delegate client key rotation work. A broker that rotates its
private_key_jwtkey needs a window where the server accepts both the old and the new key. The runtime already supports that, but nothing pinned it and nothing said how to do it.NormalizeInboundGrantsonce in the vMCP validator and judge the same effective view the runtime uses. Four rows go into the existingTestValidateAuthServerIntegrationtable: canonical delegate client accepted, canonical JWT bearer policy accepted, token exchange with no clients still rejected, legacy plus canonical delegate clients rejected.private_key_jwtdelegate without atoken_exchangeblock, for users upgrading from earlier releases.keySigningAlgorithmdoc comment. An RSA key withoutalgdoes not imply RS256; RS256 is only the default.Type of change
Test plan
task test): ran the full suite on the final commits. Everything passes except three Docker-dependent tests inpkg/container/docker:TestEgressSquidIPv6ConfigValidatesAgainstRealSquid, andTestEnvoyBootstrap_ValidatesAgainstRealEnvoywith its two subtests. They start real squid and envoy containers and fail here with "Cannot connect to the Docker daemon" because no daemon was running on my machine. This PR does not touch that package. I also rango test -raceon the three packages it changes (pkg/vmcp/config,pkg/authserver,pkg/authserver/server/registration), and they pass.task test-e2e): not run.task lint-fix): 0 issues, and it left the tree unchanged.go veton the three changed packages is also clean.Checks on the new tests:
main's validator. I restoredmain's version ofvalidator.go, saw exactly those two rows fail, then put the change back. The two rejecting rows were added after that check and I did not run them againstmain's validator.Changes
pkg/vmcp/config/validator.gopkg/vmcp/config/validator_test.goTestValidateAuthServerIntegrationpkg/authserver/config.gopkg/authserver/server/registration/configured_client.gopkg/authserver/configured_client_runner_integration_test.godocs/arch/17-token-exchange-delegation.mdDoes this introduce a user-facing change?
Yes.
inbound_grantsfailed with "auth server requires at least one upstream unless delegate clients or a trusted issuer with JWT bearer grant is configured". The VirtualMCPServer went toFailedwithAuthServerConfigValidated=False. After: it is accepted.delegate_clientsandinbound_grants.token_exchangetogether passed the vMCP validator when it had no upstreams, and failed later at runtime. After: it fails in the validator with "auth server inbound grants are invalid", wrapping the normalization error. On the operator path the conflict was already caught while building the RunConfig.private_key_jwtdelegate client without atoken_exchangeblock now ends with the change that keeps the old behavior: settoken_exchange.self_issued_subject_tokenstoany. The existing message is still a prefix of the new one.Special notes for reviewers
RunConfig.Validateand, on the operator path, byValidateInboundGrants.inbound_grants.spiffe_client_authwith no upstreams is still rejected here, as before. The CRD accepts it, so the layers disagree. I left that alone.