Repository navigation
Description
Summary
The embedded authorization server's DCR endpoint hardcodes token_endpoint_auth_method to none and refuses any client that registers with a different method or that expects a client_secret returned in the DCR response. This blocks any MCP client that implements OAuth as a confidential client.
Currently failing in production: Perplexity's MCP integration. ChatGPT's MCP support appears to follow the same confidential-client pattern (unverified in our setup — flagging as likely affected based on its public OAuth UX, would be good to confirm).
Working fine with the current implementation: Claude Code, Claude Desktop, Cursor, MCP Inspector (all public-client + PKCE).
Reproduction
- Deploy ToolHive operator v0.27.2 with a
VirtualMCPServerthat usesauthServerConfig(embedded AS, any upstream — e.g. AWS Cognito or Google via OIDC upstream provider). - In Perplexity's MCP server configuration, add the vMCP URL (e.g.
https://mcp.example.com/).
First failure (already addressed by adding offline_access to advertised scopes — separate concern, calling out for completeness):
[API_CLIENTS_ERROR] {"error":"invalid_client_metadata","error_description":"default scope not supported by server: offline_access"}
After adding offline_access to incomingAuth.oidcConfigRef.scopes, second failure:
[API_CLIENTS_ERROR] Dynamic client registration did not return a client_secret
Server-side, the AS logs failed to create access request with error: "invalid_client" once Perplexity attempts the token exchange with a client_secret it expected but never received.
Root cause
pkg/authserver/server/registration/dcr.go:219-229 at tag v0.27.2:
// 5. Validate/default token_endpoint_auth_method
authMethod := req.TokenEndpointAuthMethod
if authMethod == "" {
authMethod = "none"
}
if authMethod != "none" {
return nil, &DCRError{
Error: DCRErrorInvalidClientMetadata,
ErrorDescription: "token_endpoint_auth_method must be 'none' for public clients",
}
}This is reinforced by /.well-known/openid-configuration, which advertises:
"token_endpoint_auth_methods_supported": ["none"]The intent is clearly to enforce the OAuth 2.1 / RFC 7591 best practice for native clients (no shared secrets in distributed apps), which is correct for many MCP clients. However, some commercial MCP clients (Perplexity, likely ChatGPT) implement their MCP integration as a server-side confidential client and require a client_secret to be issued at DCR time. For those clients, there is no workaround on the client side; the AS must support client_secret_basic or client_secret_post.
Impact
| Client | Behaviour |
|---|---|
| Claude Code, Claude Desktop, Cursor, MCP Inspector | ✅ Work (public client + PKCE) |
| Perplexity | ❌ Fail at DCR — needs client_secret returned |
| ChatGPT | Likely ❌ — uses confidential-client OAuth in its other integrations |
| VS Code | ✅ (per #2585) |
| WindSurf | Untested per #2585 |
Without confidential-client support, the embedded AS cannot serve as the auth surface for the full set of MCP-capable clients an enterprise may want to support.
Proposed solution
Add an opt-in flag on EmbeddedAuthServerConfig (e.g. allowConfidentialClients: bool) that, when set:
- Accepts
token_endpoint_auth_methodvalues ofclient_secret_basicandclient_secret_post(in addition tonone) at/oauth/register. - Returns a freshly generated
client_secretin the DCR response when the registered method requires one (RFC 7591 §3.2.1). - Stores the secret hashed in the credential store (the work in Persistent DCRCredentialStore backends (memory + Redis) #4979 / Persistent DCRCredentialStore: wire into EmbeddedAuthServer #5185 already provides the persistence layer).
- Validates
client_secret_basic/client_secret_postat/oauth/token. - Advertises the additional methods in
token_endpoint_auth_methods_supportedonly when the flag is set.
This keeps the safe default (PKCE-only public clients) while letting operators opt into confidential clients when they need to support clients like Perplexity. The field documentation should mention that operators are accepting the risk of leaked secrets in distributed clients.
Alternative: support Client ID Metadata Document (CIMD) as a third path — but CIMD doesn't issue client_secret either, so it doesn't directly help Perplexity unless Perplexity adds CIMD support too.
Workarounds
For users hitting this today:
- Skip Perplexity — use only public-client MCP clients (Claude Code, Cursor, etc.).
- Use a different IdP that supports both public and confidential DCR — Keycloak, Authentik, ZITADEL, Auth0 — and point
MCPOIDCConfigdirectly at it without the embedded AS. Adds infra weight and isn't a great fit if Cognito/Google is already the source of truth.
References
- RFC 7591 §3.2.1 — DCR response with
client_secretfor confidential clients - RFC 6749 §2.3.1 —
client_secret_basic - Related: Validate that authentication works in major clients #2585 (validate auth across major clients — doesn't currently include Perplexity/ChatGPT)
- Related: Support Client ID Metadata Document (CIMD) in the embedded authorization server #4825 (CIMD support — alternative for clients that publish their own metadata)
Activity
jerm-dro commentedon Jun 26, 2026
Thanks for the report, @nuclon, and for the unusually thorough write-up. The root-cause pointer, the client-by-client breakdown, and the RFC references all made this easy to understand.
This is something we would like to see supported. It is involved work, though, and it is not on our near-term roadmap: it touches the DCR endpoint and the token endpoint, requires issuing and securely storing
client_secrets in the embedded AS, and updating the well-known metadata advertisement, all while keeping the safe public-client + PKCE default intact.We have labelled this
good-tenth-issueto signal that we would welcome a community PR. Given the security surface, anyone picking it up should open a short design discussion or a draft PR first so we can align on approach before going deep. cc @jhrozek, who can review any proposed changes here. Thanks again for raising it.Sanskarzz commentedon Jul 3, 2026
@jerm-dro , I am interested in giving this a try. Please assign me. Thanks
ChrisJBurns commentedon Jul 30, 2026
@Sanskarzz apologies for the silence, you asked 27 days ago and should not have had to wait. Assigning this to you.
Before going deep, please post a short design outline in this issue, as @jerm-dro asked. The security surface is the reason: this means issuing and storing
client_secrets in the embedded AS, changing the token endpoint's client authentication, and updating the advertisedtoken_endpoint_auth_methods_supported, all while keeping public-client plus PKCE as the default and not weakening it for the clients that work today. Worth covering how secrets are generated and stored, what a confidential client's DCR response looks like, and how an operator opts in.Your work on #5377 for client-secret expiry and renewal is the closest thing in the tree, so some of that groundwork should carry over.
One clarification for anyone reading this later: the hardcoded rejection is still present on main, at
pkg/authserver/server/registration/dcr.go. #5866 has a similar-sounding title but addresses the opposite direction, our AS acting as an OAuth2 client to an upstream IdP, so it does not cover this.@nuclon, thanks for the original write-up. This has not moved as fast as it should have, and the report is still accurate.
jhrozek commentedon Aug 5, 2026
@Sanskarzz — here's the design outline @jerm-dro and @ChrisJBurns asked for, written up as a full implementation plan so you have something concrete to build against or push back on. I went through the auth server code, checked how Ory Hydra (same fosite version we're on) and agentgateway handle this, and read it against RFC 7591/6749, OAuth 2.1 and the MCP authorization spec. Please treat it as a proposal, not a spec handed down — if you disagree with any of it, say so on the issue before writing code.
The short version of what changed relative to the issue description:
/oauth/registeris unauthenticated, so a cost-10 bcrypt on registration — and worse, on every wrong-secret attempt at/oauth/token— is a CPU amplifier against a process that also carries MCP traffic. Since the secret is 32 bytes of CSPRNG output and never client-chosen, SHA-256 + a constant-time compare viafosite.Config.ClientSecretsHasheris both correct and cheaper. Hydra moved off bcrypt for exactly this reason. This is free to do now and awkward later, since no client secrets exist yet.client_secret_expires_atshould beclient_id_issued_at + 30d, not0. Registrations already carry a 30-day idle TTL, so claiming "never expires" would be false, and without RFC 7592 a client has no way to recover except by hittinginvalid_client. Advertising the real expiry makes re-registration the documented recovery path. Bonus: because the value is never zero, the existingomitemptyfield works unchanged.token_endpoint_auth_method, and defaulting them tononewould silently turn an existing confidential client public;publicand the auth method are two sources of truth that must not be allowed to disagree (if they do, fosite returns early and never verifies the secret at all); and applying the DCR TTL byIsPublic()would attach a 30-day expiry to pre-provisioned confidential clients on their next token request. Commit 1 handles all three, and it needs to land first.client_secret_basicclient sending credentials in the body is rejected too. That's worth knowing because OAuth 2.1 §2.4 actively recommends body credentials, so it's a plausible Perplexity failure mode. If it bites, the fix is a customClientAuthenticationStrategy, not looser secret handling.Two things I could not settle from the code and would like an answer to before commit 4 is written: does Perplexity send its
client_secret_basiccredentials in the header or the request body? The whole feature hinges on that matching fosite's pin. If you can capture the DCR request and the token request from a real attempt, that would settle it. Second, someone should confirm fosite'sGetSecretsHasheris used only for client secrets in v0.49.0 before the hasher swap lands.Each commit below has a deliverable and acceptance criteria, so it should be reasonably mechanical to work through, and there's a kind e2e in there that reuses the existing Dex-based headless PKCE harness rather than needing a browser. Happy to review as you go.
Full implementation plan (11 commits, with deliverables and acceptance criteria)
Issue #5321 — Confidential-client DCR in the embedded auth server
Context
The embedded AS hardcodes
token_endpoint_auth_methodtonone(
pkg/authserver/server/registration/dcr.go:157-167) and advertises only["none"]indiscovery (
handlers/discovery.go:116). Any MCP client implementing OAuth as a confidentialclient — Perplexity today, probably ChatGPT — fails DCR with "Dynamic client registration did
not return a client_secret", with no client-side workaround. Add an opt-in flag that accepts
client_secret_basic/client_secret_post, mints a secret at registration, and keepspublic-client + PKCE as the untouched default.
One branch, commits in the order below. The issue is assigned to a community contributor
(Sanskarzz) who was asked for a design outline first — post the design comment (last section)
before or alongside implementing, and coordinate on the issue.
MCP 2025-11-25 requires OAuth 2.1 "with appropriate security measures for both confidential
and public clients", so this moves the AS toward the spec rather than merely permitting
something exotic. Worth saying in the issue comment.
What already exists — reuse, don't rebuild
registration/client.go:156-182; 3 live callers (integration_test.go:699,integration_delegation_audit_test.go:161,261) all usingclient_secret_postand working end to endclient_secret/client_secret_expires_atresponse fieldspkg/oauthproto/dcr.go:122,126pkg/oauthproto/constants.go:41-51(imported assharedobauthindiscovery.go)storedClient.Secret—storage/redis.go:169/oauth/tokenNewAccessRequest; verified against Hydra's token handler — no hand-written client-auth code neededRenewClientTTLon every successful token response incl. refreshhandlers/token.go:100-113golang.org/x/time/rate— already a direct dep (go.mod:73)InsecureAllowHTTP(notCIMDEnabled, which is a nested pointer struct)getEmbeddedASToken+deployDex+registerOAuthClient—test/e2e/thv-operator/virtualmcp/helpers.go:1539,1682,1871Panel findings folded in
Reviewed by five panelists: Ory Hydra (same fosite v0.49.0), agentgateway, oauth-expert,
toolhive-expert, kubernetes-expert.
Security, adopted as in-scope work:
/oauth/register, and worse on/oauth/token— register once, then hammer with a wrongsecret and force one bcrypt verify per attempt. The AS is in-process with the proxy data
path, so this starves MCP traffic. The secret is 256 bits of CSPRNG output; a
password-stretching KDF protects nothing. Swap to SHA-256 +
subtle.ConstantTimeCompareviafosite.Config.ClientSecretsHasher. Free only until this ships — zero bcrypt client rowsexist today because
registration.New's only production caller passesPublic: true./oauth/register(rate.NewLimiter(1, 5), global not per-IP — per-IP isevadable and the map is itself unbounded).
http://localhostorcursor://is by construction a public client (OAuth 2.1 §2.1); minting it a secret shipsthat secret inside a distributed binary. Costs nothing for Perplexity/ChatGPT, which register
https. Also: do not wrap confidential clients in
LoopbackClient— no dynamic-port matchingfor a secret holder.
Correctness / upgrade hazards:
fosite then returns at
client_authentication.go:215without ever callingcheckClientSecret. The precise trigger is the stored client not satisfyingfosite.OpenIDConnectClient— today'sredisClientnever does, which is why the bug islatent rather than live. Fail closed in both directions (commit 1).
""). A blanket""→nonedefault turns an existingconfidential row into a public one. Three-way read logic required.
registration.Newmust reject an empty/unknown method rather than defaulting — silentlydefaulting is the same public-ification bug one layer up. The three existing confidential
test clients must be migrated to an explicit
client_secret_post."mirror CIMDEnabled"was wrong:CIMDEnableddoesn't exist onRunConfig(it's a nestedCIMDRunConfigpointer). Template isInsecureAllowHTTP.vmcpconfig/converter.go:469was the wrong file — that's the incoming-OIDC-middleware config.The vMCP path already delegates to
controllerutil.BuildAuthServerRunConfig(
converter.go:535), socontrollerutil/authserver.go:590is the only mapping site.task docsis CLI docs. CRD API docs come fromtask crdref-gen, run from the repo root.confidential clients — and Redis
EXPIREon a key with no TTL creates one, so an existingpermanent client would acquire an expiry on its first token request after upgrade.
MatchRedirectURIhas no callers in fosite's matching path (authorize_helper.go:66readsonly
GetRedirectURIs()). The wrapper's only live effect is exposingGetTokenEndpointAuthMethod. Its doc comment is already misleading and must be corrected.base64.RawURLEncodingis load-bearing: fositeurl.QueryUnescapes both Basic components(
client_authentication.go:308-311), so+///%in a secret would corrupt or error.client_secret_basicclientsending body credentials is rejected too (
:207-208), not just the reverse. OAuth 2.1 §2.4makes body credentials the MUST and calls the Basic encoding rule an interop hazard, so this
pin is a deliberate deviation worth recording: if real-client testing hits it, the fix is a
custom
ClientAuthenticationStrategy, not loosening secret handling."none"-first in discovery is not a control — RFC 8414 defines no ordering semantics.Keep it (harmless), but don't present it as a mitigation. Real blast radius is narrower than
first thought: an existing
noneclient can't break (it has no secret to send); what changesis that new registrations from negotiating clients will ask for
client_secret_basic.Refuted, so nobody "fixes" them: the flag does not widen the AS's exposure to upstream IdP
tokens — a confidential refresh grant is strictly stronger than today's public one, since it
requires the secret in addition to the refresh token; multi-tenancy is
unaffected (per-instance AS, per-
{ns}:{name}Redis prefix); no audit/OTel/access-logmiddleware exists on the AS chain, so no secret leaks there — but that is now a load-bearing
invariant, so don't add request logging to this chain later;
task genis not needed (nointerface signature changes); CIMD is unaffected (
cimd_decorator.go:139rejects non-nonedocuments — leave it, do not "consistency-fix" it to follow the flag).
Settled decisions
allow_confidential_clients/allowConfidentialClients, default false ⇒ byte-identicalserver behaviour to today.
none(still the default on omission),client_secret_basic,client_secret_post. Nothing else (fosite rejectsclient_secret_jwtoutright;private_key_jwtis the RFC 9700-preferred long-term answer and pairs with CIMD — out of scope,say so in the design comment since MCP allows CIMD clients to use it).
crypto/rand→base64.RawURLEncoding(43 chars), returned once, hashedwith SHA-256 at rest, never logged.
client_secret_expires_at = client_id_issued_at + DefaultDCRClientTTL(30 days) — truthfulat issuance and it makes re-registration the documented recovery path, so RFC 7592 stays out
of scope legitimately. Because that value is never 0, the existing
int64+omitemptyfield works as-is (public registrations omit the key; confidential ones emit it). No
pointer change, no ripple into
pkg/auth/dcr. Leave a comment: if anyone ever changes thisto 0,
omitemptysilently drops the RFC-required key — the raw-JSON test is the guard.RedirectURIPolicyAllowPrivateSchemes(any https host, loopback http, private schemes) staysexactly as-is for
noneclients. The new confidential path is https-only-non-loopback withno
LoopbackClientwrapper: that restricts new functionality rather than changing existingbehaviour, so it carries no upgrade risk.
allow_confidential_clients+insecure_allow_httpis a loud warning, not a hard gate(decided): WARN at AS startup naming the consequence, plus an operator condition
reason. A hard gate would make the flag-on path untestable in kind — every embedded-AS e2e
runs an in-cluster
http://issuer — and would break the in-cluster-HTTP posture theInsecureAllowHTTPdoc comment already blesses.be a downgrade lever reachable from unauthenticated DCR. Make the rejection text name PKCE and
code_challenge_methods_supported, because the first person to hit it will otherwise "fix" itby disabling
EnforcePKCE.Commits
1. Fail-closed client persistence in Redis
Deliverable:
pkg/authserver/storage/redis.go+redis_test.go.storedClientgainsTokenEndpointAuthMethod string \json:"token_endpoint_auth_method,omitempty"`; theredisClienttype is deleted;GetClientrebuilds a*fosite.DefaultOpenIDConnectClient`.Three-way read logic, so drift in either column can only add secret verification:
Write path: populate from a
fosite.OpenIDConnectClientassertion; on failure leave the fieldempty (no
nonefallback) and letPubliccarry the meaning it already carries. Don'troute through
registration.New— it would re-hash an already-hashed secret. CorrectNewLoopbackClient's doc comment (the RFC 8252 claim is false as a fosite hook).Acceptance:
client_secret_basicround-trips with that method andIsPublic() == false."public": true, no method key) →IsPublic() == true, methodnone,and still completes a code flow.
"public": false, no method key) →IsPublic() == falseand doesnot satisfy
fosite.OpenIDConnectClient(assert by type assertion). Upgrade-safety pin."public": true+client_secret_basic) →IsPublic() == false.mockClient(non-OIDC,public: false) round-trips as non-public — the exploitable hole closed.GetHashedSecret()after round-trip is byte-identical to what was stored (no re-hash).GetClientfor a modern row satisfiesfosite.OpenIDConnectClient—that assertion, not the
Publicfield, is what activates fosite's method enforcement.2. SHA-256 client-secret hasher
Deliverable: a
fosite.Hasherimplementation (SHA-256 +subtle.ConstantTimeCompare, ~15lines) wired via
fosite.Config.ClientSecretsHasherinNewAuthorizationServerConfig(
server/provider.go:~240), withregistration.Newhashing identically. Replacesbcrypt.GenerateFromPasswordatregistration/client.go:163. Comment states why: the secret is32 bytes of CSPRNG output, never client-chosen (the DCR request struct has no
client_secretfield — keep it that way), so there is nothing for a KDF to protect, and bcrypt on an
unauthenticated endpoint is a CPU amplifier.
Verify during implementation: that fosite's
GetSecretsHasheris used only for clientsecrets in v0.49.0 and nothing else depends on the bcrypt shape.
Acceptance:
Compareaccepts the correct secret, rejects a wrong one, and rejects a truncatedone; the comparison is
subtle.ConstantTimeCompareby construction (assert on the code path,not by timing).
/oauth/tokencalls complete within a bound consistent with SHA-256(single-digit ms total) — proves no per-attempt KDF.
grep -rn bcrypt pkg/authserverreturns no hits.3. Flag plumbing
Deliverable: the flag threaded through all seven hops, template
InsecureAllowHTTP:RunConfig(config.go:36-120,//nolint:lllon the tags) →runner/embeddedauthserver.go:227-244literal →
authserver.Config(next toInsecureAllowHTTP,~:688) →server_impl.go:130-144params literal →
AuthorizationServerParamsfield (provider.go:~110) → theNewAuthorizationServerConfigreturn literal (provider.go:265-274) — a distinct hop, and theone that silently drops the flag if missed →
AuthorizationServerConfigfield (provider.go:~72).Plus
handlers_test.go's localtestSetupOptionsstruct (:41), without which no discoverytest can be written. Plus the startup WARN when combined with
InsecureAllowHTTP, and an Infolog when enabled that names the consequence ("this server issues client secrets over
unauthenticated dynamic registration"), not just the flag name — precedent for Info here is
provider.go:194. Regeneratedocs/server/*(authserver.RunConfigis an exposed swaggermodel via
pkg/runner/config.go:303).No change needed to:
Validate/applyDefaults(plain bool), deepcopy,pkg/vmcp/cli/serve.go(tag-driven unmarshal),
pkg/vmcp/config/validator.go, mocks.Acceptance:
RunConfig→handlers.Handler.config(viabuildOAuthMetadata). A gap at any of the seven hops fails it.allow_confidential_clientsandinsecure_allow_httpset emits exactlyone WARN naming both fields and the cleartext-credential consequence; startup still succeeds.
git statusclean aftertask docs;grep allow_confidential_clients docs/server/swagger.yamlhits.task testgreen with no test changes outsidehandlers_test.go's struct.4. Accept confidential registrations and mint the secret
Deliverable:
registration/client.go:Config.Public bool→Config.TokenEndpointAuthMethod string;Publicderived; explicit enum validation in the constructor (reject""and unknownvalues per
.claude/rules/go-style.md"don't fall back silently to a default the callerdidn't request");
LoopbackClientwrapper only when public. Newregistration.GenerateClientSecret() (string, error)lives here, next to the hashing itfeeds, so
handlers/dcr.gostays transport-only. A marker interface (registration.DCRIssuedwith an unexported method, satisfied by both the public and confidential return types) so
storage can tell DCR-issued clients from pre-provisioned ones — needed by commit 6.
registration/dcr.go:ValidateDCRRequest(req, allowConfidential bool). Empty method stilldefaults to
none; flag-off keeps today's byte-identical error string. Flag-on allows the twoclient_secret_*constants; confidential registrations additionally require httpsnon-loopback redirect URIs (
invalid_redirect_uri). Replace the hardcoded"none"literalsat
:160,162andclient.go:177withoauthproto.TokenEndpointAuthMethodNone.handlers/dcr.go: mint on non-none, setClientSecretandClientSecretExpiresAt = issuedAt + int64(storage.DefaultDCRClientTTL.Seconds()).client_secret_post, and updatethe
server/doc.go:60example (comment-sync rule).Acceptance:
registration.Newreturns an error forTokenEndpointAuthMethod: ""and for anyunrecognized value.
client_secret_basicDCR → 400invalid_client_metadata, today's exact errorstring (assert the literal), no
client_secretkey in the body.client_secretand noclient_secret_expires_atkey; methodechoes
none.client_secret_basic: 201,Cache-Control: no-store, secret matching^[A-Za-z0-9_-]{43}$, and the raw JSON literally containsclient_secret_expires_atequalto
client_id_issued_at + 2592000. Assert on raw bytes, not the unmarshalled struct —this is the assertion that catches an
omitemptydrop.client_secretfield has it ignored (response secret differs).client_secret_basicwithhttp://localhost:1234/cb,http://127.0.0.1/cb, orcursor://cb→ 400invalid_redirect_uri; the same URIs withnonestill succeed.https://app.example/cbdoes not matchhttps://app.example:9999/cbat/oauth/authorize(no loopback wrapper).client_secret_jwt,private_key_jwt,tls_client_auth, and garbage → 400invalid_client_metadata, flag on or off.client_secret_basic→ authorize → redeemwith Basic auth → 200. Also with
client_id/secret percent-encoded before base64 (RFC 6749§2.3.1 form) — byte-identical for this charset, so both must pass.
invalid_clientwith noerror_debugfield and no substring ofeither secret. Unknown
client_id→ an indistinguishable response body.client_secret_postclient via Basic →invalid_client;client_secret_basicclient via body creds →invalid_client.invalid_client(not a silent successvia the
IsPublic()early return).code_challenge→ 400, error text naming PKCE andcode_challenge_methods_supported.authorize, and token paths including failures (assert over an
slogcapture handler).aud/resource restriction as oneissued to a public client with identical
AllowedAudiences(guards against theregistration.Configrewrite droppingAudience).Configliteral changed.
5. Advertise the extra methods
Deliverable:
handlers/discovery.go:116built from config (nonefirst). One edit coversboth well-known endpoints (
buildOAuthMetadatafeeds both). Upgradehandlers_test.go:191,252fromassert.Contains(…, "none")— which cannot fail — to exact-sliceassertions.
Acceptance:
token_endpoint_auth_methods_supportedequals["none"]on both/.well-known/oauth-authorization-serverand/.well-known/openid-configuration.["none","client_secret_basic","client_secret_post"],noneat index 0./oauth/registerin the same test process — noadvertise/reject skew.
public, max-age=3600(
discovery.go:143,174), so a flag flip is invisible for up to an hour to caching clients.6. TTL DCR-issued registrations, including confidential ones
Deliverable:
storage/redis.go— gate the TTL on theregistration.DCRIssuedmarker inboth
RegisterClient(:212-220) andRenewClientTTL(:243-260), not onIsPublic().Rename
DefaultPublicClientTTL→DefaultDCRClientTTL(5 sites) — a constant namedPublicgoverning confidential clients is exactly the name drift the style rules prohibit. Rewrite three
doc comments (
storage/config.go:40-42— "confidential clients don't expire" becomes false;redis.go:213-215;redis.go:243-256, whose whole security argument is phrased public-vs-confidential).Acceptance:
client_secret_basicclient carries a positive Redis TTL after registration.DefaultDCRClientTTLafter a successfulauthorization_codeandrefresh_tokenresponse (miniredisFastForward+TTL).RegisterClient(not DCR-issued, e.g. thetoken-exchange agent pattern) has TTL 0 both after registration and after
RenewClientTTL— anti-regression pin for pre-provisioned clients./oauth/tokenwith correct credentials returns 401invalid_client— the documented re-registration signal.grep -rn DefaultPublicClientTTLreturns zero hits; no comment inpkg/authserver/storage/still claims confidential clients never expire.
7. Rate-limit
/oauth/registerDeliverable: a global
rate.NewLimiter(1, 5)gate returning 429 withRetry-After, appliedto the registration route only. Global, not per-IP. Also demote
handlers/token.go:30-32and:94-96fromslog.ErrortoDebug:RFC6749Error.Error()returns only the error code, so the line is content-free, and it is now
unauthenticated-triggerable at arbitrary rate (log-ingestion DoS that drowns real errors).
Acceptance:
POST /oauth/registercalls: at least one returns 429 withRetry-After.normal use).
8. Bound the in-memory client map (splittable — pre-existing gap)
Deliverable:
MemoryStorage(the default backend,config.go:97-99) has no TTL, no cap,and a no-op
RenewClientTTL(memory.go:342-354), so/oauth/registeris an unbounded memoryleak in the same process as the proxy. Pre-existing for public clients, but the flag raises the
value of each entry, and it invalidates the "the TTL bounds keyspace" argument for the default
configuration. Add a bounded map with oldest-first eviction (a cap, not a rejection — rejecting
converts a memory DoS into a lockout DoS).
If a reviewer wants this out of the PR, split it and reference the issue from the flag's doc
comment — but do not leave the plan's Redis-only keyspace claim standing unqualified.
Acceptance: N+1 registrations on the memory backend evict the oldest rather than growing
unbounded; the surviving N still authenticate.
9. Operator surface
Deliverable:
AllowConfidentialClients boolonEmbeddedAuthServerConfig(
cmd/thv-operator/api/v1beta1/mcpexternalauthconfig_types.go:~485, byBaselineClientScopes),+kubebuilder:default=false,+optional. No CEL rule (user decision: warning, not hardgate) — instead extend
validateAuthServerConfig(virtualmcpserver_controller.go:491-575,which already mirrors the
InsecureAllowHTTP/http-issuer rule at:510) to surface the insecurecombination in the
AuthServerConfigValidatedcondition reason. No new condition type; nostatus-parity work for MCPServer/MCPRemoteProxy, which already defer to pod-startup validation.
Doc comment in the
InsecureAllowHTTPtwo-paragraph style, stating: unauthenticated/oauth/registernow mints shared secrets (rate-limited, not authenticated); registrations idleMapping:
controllerutil/authserver.go:590only — the vMCP path delegates viavmcpconfig/converter.go:535. v1beta1 is correct and needs no conversion function becausev1alpha1 aliases the v1beta1 spec types (
api/v1alpha1/types.go:57), so the field appears inboth served versions automatically.
Regenerate — note the third command runs from the repo root:
Committed artifacts: four CRD YAMLs (
files/crds/+templates/× mcpexternalauthconfigs +virtualmcpservers), each with two insertions because v1alpha1 aliases the same schema, plus
docs/operator/crd-api.md. The diff will look ~4× larger than expected; that's correct.Acceptance:
git statusclean after all three commands — i.e. theGenerate CRDsandGenerate CRD Docsjobs in
operator-ci.ymlpass.grep -c allowConfidentialClients …_virtualmcpservers.yaml≥ 2.true→RunConfig.AllowConfidentialClients == true; unset →false.VirtualMCPServerwithallowConfidentialClients: true+insecureAllowHTTP: truereconciles successfully and its
AuthServerConfigValidatedcondition reason names theinsecure combination.
zz_generated.deepcopy.godiff is empty.vmcpconfig/converter.go.EmbeddedAuthServerConfigstill passes with theAPI-server-defaulted field present.
10. Kubernetes e2e in a kind cluster
Deliverable: new
test/e2e/thv-operator/virtualmcp/virtualmcp_authserver_confidential_dcr_test.go— one
OrderedDescribe, modelled onvirtualmcp_redis_session_test.go:730-1140(minus Redisand the 2-replica bits), which is the working reference for standing up Dex + signing-key/HMAC
secrets + an
EmbeddedAuthServerConfigon aVirtualMCPServerand driving a full PKCE flow.BeforeAll: RSA signing-key + HMAC + Dex client secrets;CreateMCPGroupAndWait; onelightweight backend
MCPServer(images.GofetchServerImage);deployDex(...)(themockCallbackconnector auto-approves, so the authorize step is fully headless — no browser,no Keycloak, and
ghcr.io/dexidp/dex:v2.42.0is already pre-pulled andkind loaded by theworkflow); an inline
MCPOIDCConfig; then twoVirtualMCPServers with identical auth-serverconfig except
AllowConfidentialClients: true/ field absent. One Dex serves both — only theflag-on vMCP runs a browser flow. Timestamp-suffix every resource name (
--procs=8, shareddefaultnamespace). Reach the AS withportForwardToService(VMCPServiceName(name), 4483)inside each
It, never shared across specs.Two small helper changes in
helpers.go:registerOAuthClientgains atokenEndpointAuthMethodparam (existing call site passes"", behaviour byte-identical), andgetEmbeddedASTokenswitches/oauth/tokenfrom theclient_secretform field (:1846-1850,i.e.
client_secret_post) toreq.SetBasicAuthwhen the client registeredclient_secret_basic.The CRD-level assertion goes in
virtualmcp_authserver_config_test.go, not chainsaw:test/e2e/chainsaw/operator/validation/is executed by neitheroperator-ci.yml(lines 219-224)nor
task operator-e2e-test— a test added there would be dead on arrival. File a separateissue to wire that directory into CI; three existing CEL tests there have apparently never run.
Local loop:
task -d cmd/thv-operator kind-setup-e2e→operator-install-crds→operator-deploy-local→thv-operator-e2e-test-run(re-runnable), focus withginkgo --focus "Confidential DCR". CI:.github/workflows/test-e2e-lifecycle.yml(the only jobrunning the Ginkgo suite), kind v1.33.7/v1.34.3/v1.35.1, 30-min budget. Expected +3-5 min wall
clock.
--fail-fastis on, so any flake here kills the whole suite — the port-forward subprocessand Dex's bounded redirect chain are the two live flake risks. Do not assert on log contents
here (that's a unit assertion).
Acceptance:
task -d cmd/thv-operator thv-operator-e2e-testpasses on a clean kind cluster, and--focus "Confidential DCR"passes 3 consecutive times on a provisioned cluster.["none","client_secret_basic","client_secret_post"].["none"].client_secret_basicDCR on the flag-on vMCP: 201, non-emptyclient_secret, method echoed,and
client_secret_expires_atpresent in the raw JSON (decode tomap[string]any, not astruct).
invalid_client_metadata.client_secret_basicclient completes the Dex PKCE flow and redeems viaAuthorization: Basic, getting a non-emptyaccess_token; a mutated secret → 401invalid_client.criteria 4 and 6. If a commit can be reverted with the e2e still green, the e2e isn't
testing it.
E2E Tests Lifecyclejob stays under 30 minutes on all three kind versions.11. Docs
Deliverable: the embedded-AS section of
docs/arch/covering the flag, the default-offinvariant, the
none-first ordering and why it is not a control, the both-directions methodpinning (and that the fix for a real-client mismatch is a custom
ClientAuthenticationStrategy,never looser secret handling), 30-day idle eviction and re-registration as the recovery path,
that disabling the flag revokes nothing, the one-hour discovery cache, and the explicit
non-goals with issue links. The docs-website change is a separate repo/PR.
Acceptance:
own issue" is a promise with no owner.
Out of scope (file issues, don't build)
secret on re-read anyway.
private_key_jwt/ mTLS — RFC 9700's preferred direction and permitted for CIMD clients byMCP, but the failing real clients implement
client_secret_*only./oauth/registerand/.well-known/*— none today (grepped: zero hits).Irrelevant for server-side clients like Perplexity; a blocker for browser-side MCP clients.
agentgateway's entire
registration_endpointrewrite exists because IdPs omit CORS there.fosite.ClientWithSecretRotation) — nothing in the tree implements it;Hydra doesn't either.
test/e2e/chainsaw/operator/validation/into CI — three CEL tests there are dead.Two things to settle before writing code
client_secret_basiccredentials in the header or the body? fositepins the registered method in both directions, and OAuth 2.1 §2.4 actively recommends the
body. Commit 4's whole value proposition depends on the pin matching Perplexity's real
behaviour, and the plan otherwise defers that to the very last verification step. If a real
endpoint isn't reachable, capture it from the DCR request Perplexity sends.
GetSecretsHasheris client-secret-only in v0.49.0 before commit 2 lands.Verification
task testfor the touched packages;task lint-fix.client_secret_basicstill rejected with the byte-identical error;discovery still exactly
["none"]; no bcrypt/SHA change visible to existing clients.confidential variants. This is the one that breaks live deployments if wrong.
wrong-method (both directions), no-credentials, and missing-PKCE failures.
task -d cmd/thv-operator thv-operator-e2e-test— the kind e2e above, including therevert-a-commit-and-watch-it-fail check.
pkg/vmcp/cli/serve.go:591-610loads a siblingauthserver-config.yaml):curldiscovery →curl -X POST /oauth/registerwithclient_secret_basic→ browser flow →curl -u id:secretat/oauth/token; then remove theflag and confirm rejection (allowing for the one-hour discovery cache).
(the
setup-ngrok-gatewayskill covers this). This is the only test that closes the issue;everything above proves we built what we think Perplexity wants.
jhrozek commentedon Aug 5, 2026
Sorry about the wall of text @Sanskarzz. What I tried to say and failed with the help of Claude :-) was that this issue has bubbled up in terms of priority. Above is a proposed plan - let me know if you already started, otherwise I'd be happy to take over.
Sanskarzz commentedon Aug 5, 2026
@jhrozek Thanks for putting together the detailed implementation plan. I haven’t started the implementation yet, but I’d like to continue working on this issue.
I’ll go through the proposed plan carefully, understand the changes and security considerations, and then start the implementation. I’ll share any questions or concerns on the issue before proceeding with the relevant changes.
jhrozek commentedon Aug 5, 2026
The issue is kinda blocking me though on 2 fronts (XAA testing and finishing token delegation work) any chance you'd accept a different issue instead since you haven't started the implementation?
Sanskarzz commentedon Aug 6, 2026
@jhrozek Yes, it looks like this issue has become a priority, so please feel free to take it up.
I’m currently focused on addressing the review comments on PR #5800 , so I can pick up a different issue once that work is complete. Thanks for checking.
jhrozek commentedon Aug 6, 2026
Thank you @Sanskarzz !
jhrozek commentedon Nov 24, 2026
Closing this as fixed. Confidential clients can now register through DCR in the embedded authorization server, with a client secret issued at registration. The change is in #6252, which is merged.
The feature is opt-in: it is turned on with
AllowConfidentialClientRegistrationin the auth server config (the operator field is onMCPExternalAuthConfig). With the flag off, the server still rejects confidential registration, as before.If the fix doesn't work for your setup, or if you think the default should be on, please reopen this issue with the server config (secrets redacted) and the registration request and response.