Validate MCPOIDCConfig inline issuer and JWKS URLs#5936
Open
lopster568 wants to merge 1 commit into
Open
Conversation
The MCPOIDCConfig reconciler only checked type/config consistency, so inline configs with malformed or plain-HTTP issuer and JWKS URLs were accepted and failed later in the OIDC verification path. Wire the existing validation.ValidateOIDCIssuerURL and validation.ValidateJWKSURL helpers into the controller's validation step. The checks run at the controller layer because pkg/validation imports the v1beta1 package, so the types package cannot call it without an import cycle. Add insecureAllowHTTP: true to deploy/keycloak/mcpserver-with-auth.yaml, whose plain-HTTP issuer would otherwise fail the new check. Signed-off-by: Roshan <rosh.s568@gmail.com>
lopster568
requested review from
ChrisJBurns,
JAORMX,
blkt,
jerm-dro,
jhrozek,
rdimitrov,
reyortiz3 and
tgrunnagle
as code owners
July 23, 2026 11:10
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
MCPOIDCConfig resources with a malformed or plain-HTTP
issuerorjwksUrlare accepted today. The reconciler's only spec gate,MCPOIDCConfig.Validate(), checks type/config consistency but never inspects the URLs, so a bad issuer surfaces later as an opaque OIDC verification failure. The equivalent checks ran for inline OIDC configs on MCPRemoteProxy until #4820 removed that field.validation.ValidateOIDCIssuerURL()andvalidation.ValidateJWKSURL()into the MCPOIDCConfig controller through a newvalidateOIDCConfigSpec()helper.Validate()becausepkg/validationimports thev1beta1package, so the types package cannot call it without an import cycle. This mirrors MCPRemoteProxy'svalidateSpec.spec.inline.insecureAllowHTTPmaps to the issuer validator'sallowInsecure, so HTTP issuers that opt in keep working.insecureAllowHTTP: truetodeploy/keycloak/mcpserver-with-auth.yaml, whose plain-HTTP issuer would otherwise fail the new check.Fixes #4823
Type of change
Test plan
task test)task lint-fix)TestValidateOIDCConfigSpeccovers issuer and JWKS accept/reject cases including theinsecureAllowHTTPopt-in and the empty-JWKS discovery case.TestMCPOIDCConfigReconciler_URLValidationFailureSetsConditionasserts a bad URL setsValid=False. Existing MCPOIDCConfig controller tests pass unmodified.Two
pkg/apitests (TestNewServer_ReadTimeoutConfigured,TestSecurityHeaders) fail on my machine for want of a container runtime, andtask lint-fixreports one gosec finding incmd/thv/app/upgrade.go. Both reproduce unchanged onmainand neither touches this PR's files.API Compatibility
v1beta1API, OR theapi-break-allowedlabel is applied and the migration guidance is described above.No CRD schema change; this is controller-level validation only.
Does this introduce a user-facing change?
Yes. Inline configs with a malformed issuer, an HTTP issuer without
insecureAllowHTTP: true, or a non-HTTPS JWKS URL now getValid=Falseat reconcile time instead of failing later during OIDC verification. Stored objects previously accepted with such values flip to invalid on their next reconcile.Special notes for reviewers
Scope is limited to inline configs.
kubernetesServiceAccountconfigs default their issuer to the in-cluster URL and have noinsecureAllowHTTPescape hatch, so validating them here could break clusters using custom internal issuers. Happy to follow up separately.deploy/keycloak/mcpserver-with-auth.yaml'sjwksUrlis plain HTTP andValidateJWKSURLrequires HTTPS with no escape hatch, so that manifest still fails validation after this PR. Dropping the explicitjwksUrlwould fall back to discovery, but its comment says the explicit URL exists to avoid discovery issues. Which would you prefer?