Propagate protectedResourceAllowPrivateIP through OIDC resolver and converter#4784
Conversation
…onverter The protectedResourceAllowPrivateIP CRD field was defined but never propagated through the OIDC resolver, and the vmcpconfig converter incorrectly mapped it from jwksAllowPrivateIP. This meant the field had no effect and could not be controlled independently. Add ProtectedResourceAllowPrivateIP to the resolver OIDCConfig struct, propagate it through inline, shared inline, and ConfigMap resolve paths, fix the converter to use the correct source field, and add the missing JwksAllowPrivateIP mapping. Fixes bugs 2 and 3 from #3142. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4784 +/- ##
==========================================
- Coverage 68.94% 68.92% -0.03%
==========================================
Files 517 517
Lines 54741 54749 +8
==========================================
- Hits 37742 37735 -7
- Misses 14095 14107 +12
- Partials 2904 2907 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ChrisJBurns
left a comment
There was a problem hiding this comment.
Multi-Agent Consensus Review
Agents consulted: kubernetes-expert, go-security-reviewer, code-reviewer, toolhive-expert
Recommendation: ✅ APPROVE
Consensus Summary
| # | Finding | Consensus | Severity | Action |
|---|---|---|---|---|
| 1 | MCPServer/MCPRemoteProxy paths drop ProtectedResourceAllowPrivateIP | 8/10 | HIGH | Comment (pre-existing) |
| 2 | Downstream factory ORs both fields into single AllowPrivateIP | 7/10 | MEDIUM | Comment (pre-existing) |
| 3 | Missing ConfigMap independence test | 7/10 | LOW | Suggest |
Overall
This is a clean, well-scoped bug fix. The core change -- adding ProtectedResourceAllowPrivateIP to the resolver's OIDCConfig struct, propagating it through all three resolution paths (inline, shared inline, ConfigMap), and fixing the converter mapping -- is correct and addresses both bugs from #3142.
All three findings that survived consensus scoring are either pre-existing issues (F1, F2) or a minor test gap (F3). No agent identified any issues introduced by this PR. The test suite includes independence assertions that verify the two fields can be controlled separately, which directly guards against regression of the original bug. The behavioral change (separating jwksAllowPrivateIP from protectedResourceAllowPrivateIP) is clearly documented in the PR description.
The main pre-existing gaps to track: (1) MCPServer and MCPRemoteProxy CRD paths still don't propagate ProtectedResourceAllowPrivateIP through runner.WithOIDCConfig, and (2) the downstream auth factory ORs both fields into a single AllowPrivateIP, limiting the practical granularity of the separation.
Generated with Claude Code
Address review feedback (F3): add a ConfigMap test case where jwksAllowPrivateIP is true but protectedResourceAllowPrivateIP is absent, verifying they resolve independently. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…verter mappings Add doc comments to JWKSAllowPrivateIP and ProtectedResourceAllowPrivateIP on both InlineOIDCSharedConfig and InlineOIDCConfig noting that at runtime either field being true enables private IPs for all OIDC HTTP requests. Also add missing JWKSURL and IntrospectionURL mappings in mapResolvedOIDCToVmcpConfigFromRef, which silently dropped these fields for the MCPOIDCConfig reference path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jhrozek
left a comment
There was a problem hiding this comment.
LGTM -- clean bug fix with good test coverage
Summary
The
protectedResourceAllowPrivateIPCRD field was defined on both MCPServer and VirtualMCPServer but never actually propagated through the OIDC resolver, making the field a no-op. Additionally, the vmcpconfig converter incorrectly mapped it fromjwksAllowPrivateIP, meaning the two fields could not be controlled independently.Fixes bugs 2 and 3 from #3142 (Bug 1 was fixed separately via #4250).
The MCPServer/MCPRemoteProxy runner path remains out of scope — tracked in #4787.
Medium level
ProtectedResourceAllowPrivateIPfield to the internaloidc.OIDCConfigstruct so it can carry the value from CRD types through to consumersProtectedResourceAllowPrivateIPfrom the correct source field (was incorrectly usingJWKSAllowPrivateIP)JwksAllowPrivateIPmapping in the converter so the auth factory's OR logic (ProtectedResourceAllowPrivateIP || JwksAllowPrivateIP) works correctlyJWKSURLandIntrospectionURLmappings inmapResolvedOIDCToVmcpConfigFromRef(pre-existing gap fixed opportunistically)Low level
cmd/thv-operator/pkg/oidc/resolver.goProtectedResourceAllowPrivateIPtoOIDCConfigstruct; propagate inresolveInlineConfig,resolveFromInlineSharedConfig,resolveConfigMapConfig; extractconfigMapBoolTrueconstantcmd/thv-operator/pkg/vmcpconfig/converter.gomapResolvedOIDCToVmcpConfigandmapResolvedOIDCToVmcpConfigFromRefto use correct source field; add missingJwksAllowPrivateIP,JWKSURL,IntrospectionURLmappingscmd/thv-operator/api/v1alpha1/mcpoidcconfig_types.gocmd/thv-operator/api/v1alpha1/mcpserver_types.gocmd/thv-operator/pkg/oidc/resolver_test.gocmd/thv-operator/pkg/oidc/resolver_configref_test.gocmd/thv-operator/pkg/vmcpconfig/converter_test.goType of change
Does this introduce a user-facing change?
Setting
protectedResourceAllowPrivateIP: trueon VirtualMCPServer OIDC config now works as documented. Previously the field was silently ignored.Note: The field remains a no-op for MCPServer and MCPRemoteProxy — those resource types use a different runner path that only supports
jwksAllowPrivateIP. This is tracked in #4787.Behavioral note: Setting
jwksAllowPrivateIP: truepreviously had the unintended side effect of also enabling private IPs for the protected resource endpoint. After this fix, users who need both must set both fields explicitly.Test plan
task lint-fixpasses (0 issues on affected packages)task testpasses oncmd/thv-operator/pkg/oidc/...andcmd/thv-operator/pkg/vmcpconfig/...task buildpasses forcmd/thv-operator/...Special notes for reviewers
ProtectedResourceAllowPrivateIP— those paths auto-configure for cluster-internal OIDC whereJWKSAllowPrivateIPis the relevant setting.Generated with Claude Code