Repository navigation
Conversation
…check the keys AS-2 loaded The embedded gateway's signing key settings now refuse: - an Ed25519 key, or an ECDSA curve other than P-256, P-384, or P-521. ToolHive's authorization server signs with Ed25519 as EdDSA, but its token validator accepts only RSA and ECDSA, so every gateway token would get a 401. - a key listed twice, the signing key repeated as a fallback included, which would publish one key ID twice. Startup read the key files once for the check against the identity broker's keys, and ToolHive read them again. After the build, the MCP broker now checks the public keys AS-2 actually loaded against the identity broker's keys too, and refuses, failing closed, a key it cannot compare. A built AS-2 other than the entry's now names the field that differs. Co-Authored-By: mecatl <[email protected]>
…e hosted AS-1 retry Rebasing onto #2937 made a gateway entry's servers follow the stricter server-name rule (letters, digits, and single underscores). The doc comments on ValidateGatewayEntries and WithGateway now say so, and the core and loader tests refuse a dotted server and a double underscore. TestHostedAS1IssuesTheGatewaysIDJAGs again pins the outcome: the broker retries the reasonless invalid_grant once, so the call fails with CodeInternal after two ID-JAGs and two redemptions. Co-Authored-By: mecatl <[email protected]>
…essages The "no embedded gateway" case expected an empty message, so any render failure passed; it actually stopped at the empty callback URL rule, and now asserts that rule's message. New cases cover a signing key with no Secret and a Secret with no key, fallbacks without a signing key, a fallback that is a broker key, and a gateway entry with the identity broker off. An entry without a broker client key is not covered here: without AS-1 the production profile first needs a full OIDC client. Co-Authored-By: mecatl <[email protected]>
…audience The operator guide said turning the identity broker on or off changes the audience of the MCP gateway's tokens. Since #2946 the embedded gateway entry decides it: without an entry the audience is the gateway's issuer, with one it is the entry's resource, so adding or removing the entry is what makes users enroll protected MCP servers again. The guide and values.yaml also say that every key in the broker client's key set must be EC P-256, that the key is registered at the MCP gateway only with a gateway entry, and that an entry requires it. The "Declare the embedded gateway" section now shows the chart values, whose names (as2Issuer, tokenEndpoint) differ from the file's. Co-Authored-By: mecatl <[email protected]>
rdimitrov
approved these changes
Nov 23, 2026
rdimitrov
left a comment
Member
There was a problem hiding this comment.
LGTM. These changes should go into #2946's branch before #2946 merges.
- Refusing Ed25519 is correct: ToolHive signs with EdDSA, but its validator accepts only RSA and ECDSA (stacklok/toolhive#7250), so every gateway token would have been refused. Accepting only P-256, P-384, and P-521 moves ToolHive's late refusal to startup, where the error names the file.
- Running the broker-key comparison again on the keys AS-2 actually loaded (
KeyProvider().PublicKeys) closes the window where the file changes between the two reads. Failing closed on a key type that can't be compared is the right default. - The duplicate-key refusal, the named field in the post-build mismatch error, and the fixed Helm assertions (the "no embedded gateway" case used to pass on any failure) are all real fixes.
- I agree with the note that the same-issuer check lives only in the loader. #2559 and #2812 will need to repeat it when they add a second source of entries.
jhrozek
merged commit Nov 23, 2026
a13d09f
into
feat/identitybroker-gateway-entries
45 checks passed
This branch was successfully deployed
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
Follow-ups from reviewing #2946, stacked on
feat/identitybroker-gateway-entries. Merge this into #2946's branch before #2946 merges. Chris is away, so these are separate commits for him to review when he's back.mcp.broker.signing_key_fileandfallback_key_fileswere documented as RSA, ECDSA, or Ed25519. ToolHive's authorization server signs with an Ed25519 key as EdDSA, but ToolHive's token validator accepts only RSA and ECDSA, so every gateway token would get a 401 after a clean start (Embedded auth server signs with an Ed25519 key, but ToolHive's token validator refuses EdDSA tokens toolhive#7250). A P-224 key passed Mecatl's checks and was refused by ToolHive later in startup. Startup now refuses both and accepts RSA and ECDSA on P-256, P-384, or P-521.TestHostedAS1IssuesTheGatewaysIDJAGsagain pins the outcome:CodeInternalafter one retry, so two ID-JAGs and two redemptions.values.yamlalso say every broker client key must be P-256, and the chart example uses the chart's value names.Issue relationship
Relates to #2538
Type of change
Test plan
Baseline checks
golangci-lint runon./internal/adapter/mcpbroker/...,./internal/app/,./internal/identitybroker/...,./internal/adapter/permconfig/, anddeploy/helm/mecak8s, 0 issuesgo teston./internal/adapter/mcpbroker/,./internal/identitybroker/..., the gateway, broker, and key tests in./internal/app/, anddeploy/helm/mecak8spasstask test): left to CItask test:race): left to CItask docslink check, 0 broken links, anchors, or orphanstask docs:configrefregeneratedconfiguration.mdand the settings skeletonNew tests:
TestSigningPublicKeysRefusesKeysTheVMCPCannotVerify: Ed25519 and P-224 refused as signing key or fallback; RSA and P-384 accepted.TestSigningPublicKeysRefusesAKeyListedTwiceTestBuildMCPBrokerRefusesAS2SigningWithABrokerKey: the check after the build refuses a key AS-2 loaded that is a broker key.TestCheckAS2KeysAreNotBrokerKeysFailsClosedTestAS2SigningKeyRotationalso checks that AS-2 reports the keys it loaded.User-facing change
An embedded-gateway signing key that is Ed25519, on an ECDSA curve other than P-256, P-384, or P-521, or listed twice now stops startup with an error naming the file. Before this, such a key either started and then failed every gateway call, or failed later in startup. The operator guide now says the gateway entry, not the identity broker setting, decides when users must enroll protected MCP servers again.
API compatibility
This PR adds no remote-observable change. It does change the assessment for #2946, whose description doesn't mention this: for a deployment with the identity broker, AS-1, and a protected MCP server, the MCP gateway's token audience was
<issuer>/mcpbefore #2946. After upgrading without a gateway entry it is<issuer>, and users must enroll their protected MCP servers again. Adding the entry later moves it back to<issuer>/mcp, which means enrolling again. The token audience is visible to clients, so this belongs in #2946's release notes.Special notes for reviewers
🤖 Generated with Claude Code