Repository navigation
Map thvCABundle to OIDCConfig.CACertPath - #3391
Conversation
The WithOIDCConfig() function receives thvCABundle and jwksAuthTokenFile parameters but was not mapping them to OIDCConfig.CACertPath and OIDCConfig.AuthTokenFile. This meant custom CA certificates for OIDC validation were never used by the token validator. Add the two missing field mappings so the proxyrunner can use custom CA certificates when validating OIDC tokens against issuers with non-public certificates (e.g., corporate Keycloak instances). Related: #3141
There was a problem hiding this comment.
Large PR Detected
This PR exceeds 1000 lines of changes and requires justification before it can be reviewed.
How to unblock this PR:
Add a section to your PR description with the following format:
## Large PR Justification
[Explain why this PR must be large, such as:]
- Generated code that cannot be split
- Large refactoring that must be atomic
- Multiple related changes that would break if separated
- Migration or data transformationAlternative:
Consider splitting this PR into smaller, focused changes (< 1000 lines each) for easier review and reduced risk.
See our Contributing Guidelines for more details.
This review will be automatically dismissed once you add the justification section.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3391 +/- ##
==========================================
- Coverage 64.85% 64.82% -0.03%
==========================================
Files 375 377 +2
Lines 36626 36746 +120
==========================================
+ Hits 23753 23821 +68
- Misses 10999 11049 +50
- Partials 1874 1876 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I provided the large PR justification in the opening comment.
VirtualMCPServer referencing an MCPOIDCConfig with a ConfigMap-backed caBundleRef mounted the CA into the pod but never told the vmcp binary where to find it. OIDC discovery against a self-signed issuer then failed with "x509: certificate signed by unknown authority". The vmcp OIDCConfig had no CA-bundle field, so the operator converter silently dropped the resolver's ThvCABundlePath. This mirrors the earlier MCPServer fix (#3142, #3391). - Add CABundlePath to pkg/vmcp/config.OIDCConfig with absolute-path, no-traversal, no-null-byte validation consistent with StaticBackendConfig.CABundlePath. - Populate CABundlePath from resolved.ThvCABundlePath in the operator's mapResolvedOIDCToVmcpConfigFromRef, covering both inline caBundleRef and the Kubernetes service-account CA default. - Wire CABundlePath into auth.TokenValidatorConfig.CACertPath in newOIDCAuthMiddleware so the incoming-OIDC middleware loads the CA into its HTTP client for discovery, JWKS, and introspection. - Add unit tests at each layer and a VirtualMCPServer envtest scenario asserting the rendered vmcp-config ConfigMap contains caBundlePath and the Deployment mounts the ConfigMap read-only at the expected path. Closes #4918 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
* Propagate MCPOIDCConfig CA bundle to vmcp OIDC config VirtualMCPServer referencing an MCPOIDCConfig with a ConfigMap-backed caBundleRef mounted the CA into the pod but never told the vmcp binary where to find it. OIDC discovery against a self-signed issuer then failed with "x509: certificate signed by unknown authority". The vmcp OIDCConfig had no CA-bundle field, so the operator converter silently dropped the resolver's ThvCABundlePath. This mirrors the earlier MCPServer fix (#3142, #3391). - Add CABundlePath to pkg/vmcp/config.OIDCConfig with absolute-path, no-traversal, no-null-byte validation consistent with StaticBackendConfig.CABundlePath. - Populate CABundlePath from resolved.ThvCABundlePath in the operator's mapResolvedOIDCToVmcpConfigFromRef, covering both inline caBundleRef and the Kubernetes service-account CA default. - Wire CABundlePath into auth.TokenValidatorConfig.CACertPath in newOIDCAuthMiddleware so the incoming-OIDC middleware loads the CA into its HTTP client for discovery, JWKS, and introspection. - Add unit tests at each layer and a VirtualMCPServer envtest scenario asserting the rendered vmcp-config ConfigMap contains caBundlePath and the Deployment mounts the ConfigMap read-only at the expected path. Closes #4918 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Regenerate CRD manifests and docs for OIDC caBundlePath task operator-manifests + task crdref-gen after adding CABundlePath to pkg/vmcp/config.OIDCConfig. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * Fix stale v1alpha1 alias in CA bundle tests after merge The merge from main renamed the operator API package from v1alpha1 to v1beta1, but the CA-bundle test cases added by this PR kept the old mcpv1alpha1 alias, which the files no longer import. This broke the typecheck (lint) and the Go test build. Point the new test cases at the mcpv1beta1 alias the files already import, matching the surrounding code. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * Regenerate VirtualMCPServer CRD for OIDC caBundlePath The merge from main dropped the generated caBundlePath field from the VirtualMCPServer CRD manifests, so the operator-manifests check failed. Re-run task operator-manifests to restore the field under spec.config.incomingAuth.oidc. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> Co-authored-by: reyortiz3 <[email protected]>
The WithOIDCConfig() function receives thvCABundle and jwksAuthTokenFile parameters but was not mapping them to OIDCConfig.CACertPath and OIDCConfig.AuthTokenFile. This meant custom CA certificates for OIDC validation were never used by the token validator.
Add the two missing field mappings so the proxyrunner can use custom CA certificates when validating OIDC tokens against issuers with non-public certificates (e.g., corporate Keycloak instances).
Related: #3141
Large PR Justification
There's a bunch of autogenerated changes. I don't know how to split the PR so that it would still cover the feature but be small. I could have added the types and then implementation but that seems suboptimal.