Repository navigation
Description
Problem
MCPExternalAuthConfig has nine spec.type values, but each consumer kind supports only a subset, and the unsupported combinations fail silently instead of being rejected or reported. A user who applies one of these configs sees a valid resource and a running workload, while the credential is never injected.
Confirmed against v0.40.1 and current main:
| Referencing resource | headerInjection |
bearerToken |
|---|---|---|
MCPServer (externalAuthConfigRef) |
Silent no-op: explicit placeholder in addHeaderInjectionConfig (cmd/thv-operator/pkg/controllerutil/tokenexchange.go:386-401) |
Silently inert: wires runner.WithRemoteAuth, but remote auth only applies when RemoteURL is set (pkg/runner/runner.go:430-434), which MCPServer never sets |
MCPRemoteProxy (externalAuthConfigRef) |
Silent no-op: same dispatcher as above | Works (the only functional consumer) |
VirtualMCPServer inline outgoingAuth |
Works | Hard error: no converter registered (pkg/vmcp/auth/converters/interface.go:73-79) |
VirtualMCPServer outgoingAuth.source: discovered |
Works | Backend silently dropped from the vMCP with only a log line (pkg/vmcp/workloads/k8s.go:290-296, 457-461) |
The discovered-mode case is a bad interaction: bearerToken on an MCPRemoteProxy is a legitimate, working configuration, but fronting that proxy with a discovered-mode vMCP makes the backend vanish from aggregation.
Beyond confusion, this is a security-adjacent footgun: someone who believes headerInjection is authenticating their proxy to a backend has a workload making unauthenticated calls while the resource reads as fully configured.
Ask
- Reconcile-time validation surfaced as status conditions. When a workload references an
MCPExternalAuthConfigwhose type that kind doesn't support, setExternalAuthConfigValidated=Falsewith a reason likeUnsupportedAuthTypeinstead of no-op'ing. The mirroring plumbing already exists (this is the same flow that surfacesEnterpriseRequiredtoday). For vMCP discovered mode, surface the skipped backend inVirtualMCPServerstatus rather than log-and-drop. - Document supported consumer kinds in the CRD. State which kinds support each
spec.typein the field godoc onMCPExternalAuthConfigSpec.Typeand on each consumer'sexternalAuthConfigRef, so it flows into the generated schema descriptions and reference docs.
An admission webhook rejecting the combination at apply time would be nice UX on top, but cross-resource checks at admission are best-effort (ref may not exist yet, either side can change later), so the conditions in (1) should be the source of truth.
Context
Found while reviewing stacklok/docs-website#1053, which initially documented headerInjection/bearerToken for MCPServer and MCPRemoteProxy per stacklok/docs-website#1013. Related fields with a similar accepted-but-unwired pattern: dcrConfig.softwareId/softwareStatement are plumbed to run config but never sent in the RFC 7591 registration request (pkg/auth/dcr/resolver.go:800-807).
Activity
3nesdeniz commentedon Jul 25, 2026
I'd like to work on this. I'll wait for assignment before starting, per the contribution guide.
My proposed approach is to first encode the supported
MCPExternalAuthConfigcombinations as one table-driven contract, then make every controller surface unsupported types as an explicit status condition rather than silently continuing. I would keepv1beta1backward-compatible, add unit coverage for the full support matrix plus status propagation, and include the relevant operator/envtest path. If the complete matrix crosses the project's preferred PR size, I'll split it along the maintainer-approved boundary rather than publish a partial behavior contract.jhrozek commentedon Aug 6, 2026
go for it @3nesdeniz
3nesdeniz commentedon Aug 8, 2026
Thanks, @jhrozek. I’ve implemented the consumer compatibility contract and explicit status reporting in #6242. The change also keeps affected virtual-MCP backends fail-closed during initial discovery and dynamic watch updates while preserving healthy peers and valid explicit overrides. The branch is current with main, and the operator plus integration suites pass.
Report unsupported external auth types via status conditions
Report unsupported external auth types via status conditions
Report unsupported external auth types via status conditions
Report types a backend accepts but does not apply
Report unsupported external auth types (stacklok#6242)