Repository navigation
test(mcpbroker): show AS-2 refuses redemptions outside its configuration - #2778
Merged
Merged
Conversation
AS-2's tests only redeemed valid ID-JAGs for the vMCP resource. Add the refusals that back the configuration: a wrong or missing resource, an ID-JAG addressed to the vMCP resource or the token endpoint, and an AS-1 access token presented as the assertion, with and without client authentication. Record the two redemptions AS-2 accepts today that the design refuses, an ID-JAG whose resource claim names another server and a plain AS-1 JWT-bearer assertion without client authentication, so the tickets that close them (#2533) turn them into refusals. Co-authored-by: Mecatl <noreply@mecatl.dev>
jhrozek
approved these changes
Nov 13, 2026
Merged
2 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.
Follow-up to #2744, for @jhrozek's review comment: the AS-2 tests showed what we configure in ToolHive, but not that ToolHive refuses anything outside it.
What
Test-only change in
internal/adapter/mcpbroker/as2_test.go. It runs against the real embedded ToolHive authorization server, trusting the harness's AS-1 through the test-only seam.TestAS2RefusesRedemptionsOutsideItsConfiguration: a valid ID-JAG redeems (the positive control). Each of these is then refused with 400, its error code pinned, and no token issued:resourceis AS-2's issuer (invalid_target), another server (invalid_target), or missing (invalid_request);audis the vMCP resource or the token endpoint, not AS-2's issuer (invalid_grant);typat+jwt) is presented as the assertion, with and without client authentication (invalid_grant).TestAS2RedeemsWhatTrackedShortcutsAllow: records two redemptions AS-2 accepts today that the design refuses. The tickets that close them should turn each into a refusal, so a fix shows up as a failing test rather than going unnoticed:resourceclaim names another server is redeemed, because ToolHive checks only the request'sresource(ID-JAG redemption: compare the requested resource with the assertion's resource claim, and decide the default when it is omitted toolhive#6892, ID-JAG grant ignores the assertion's resource claim and requires a form resource toolhive#6983; Configure the embedded gateway's authorization server as AS-2 #2533). The client's audiences still limit the token to the vMCP resource, which is the "no exposure today" claim in feat(identitybroker): wire the embedded gateway's authorization server as AS-2 #2744.typJWTor absent) is redeemed without any client authentication. This confirms the gap Configure the embedded gateway's authorization server as AS-2 #2533 closes withacceptedAssertionTypes: [id_jag](PR Gate ID-JAG by issuer assertion types toolhive#6678). It's reachable only through the test-only trust today: production AS-2 trusts no issuer, and AS-1's real access tokens carrytypat+jwt, which the first test shows is refused.newTrustingAS2,as2Redemptionandas1JWTshare the setup withTestAS2RedeemsAHarnessIDJAG.Checked
mecatl's audiences are widened, or if the vMCP resource is added as an accepted ID-JAG audience. Neither can loosen silently.go test ./internal/adapter/mcpbroker/and the pinned golangci-lint pass.API compatibility
None: test-only change.