Skip to content

Embedded auth server never applies LoopbackClient's RFC 8252 §7.3 "localhost" matching: authorize rejects http://localhost:<port>/callback from CIMD/DCR clients (breaks Claude Code) #6189

Closed

Description

@alex-feel

Bug description

The embedded auth server ships registration.LoopbackClient (pkg/authserver/server/registration/client.go), which implements and documents RFC 8252 section 7.3 loopback redirect URI matching including the localhost hostname. Its doc comment (v0.41.0, lines 30-44) names the exact clients and the exact pattern the feature exists for:

// LoopbackClient is a fosite.Client implementation that supports RFC 8252 Section 7.3
// compliant loopback redirect URI matching for native OAuth clients.
//
// RFC 8252 Section 7.3 specifies that:
//   - Loopback redirect URIs use "http" (not "https")
//   - The host must be "127.0.0.1", "[::1]", or "localhost"
//   - The authorization server MUST allow any port
//   - The path and query components must match exactly
//
// This client extends fosite's built-in loopback support to also handle "localhost"
// as a loopback address. Fosite's isMatchingAsLoopback uses isLoopbackAddress()
// which only supports IP addresses (net.ParseIP().IsLoopback()), not the "localhost"
// hostname. This is needed for DCR with clients like VS Code, Claude Code, and other
// native apps that register redirect URIs like "http://localhost/callback" and then
// request authorization with dynamic ports like "http://localhost:57403/callback".
type LoopbackClient struct {
	*fosite.DefaultOpenIDConnectClient
}

Both client-registration paths of the embedded auth server wrap their public clients in this type:

  • CIMD: buildFositeClient (pkg/authserver/storage/cimd_decorator.go:229) returns registration.NewLoopbackClient(openIDClient) whenever the metadata document contains a loopback redirect URI (hasLoopbackRedirectURI gate, cimd_decorator.go:274-276).
  • DCR: registration.New wraps every public client (pkg/authserver/server/registration/client.go:174-179).

Observed fact — the matcher is never called. The two matching methods the wrapper adds, MatchRedirectURI (client.go:61) and GetMatchingRedirectURI (client.go:73), have zero call sites in the repository outside their own unit tests:

$ git grep -nE "MatchRedirectURI\(|GetMatchingRedirectURI\(" -- '*.go' ':!*_test.go'
pkg/authserver/server/registration/client.go:61:func (c *LoopbackClient) MatchRedirectURI(requestedURI string) bool {
pkg/authserver/server/registration/client.go:73:func (c *LoopbackClient) GetMatchingRedirectURI(requestedURI string) string {

$ git grep -nE "MatchRedirectURI\(|GetMatchingRedirectURI\(" -- '*.go'
pkg/authserver/server/registration/client.go:61:func (c *LoopbackClient) MatchRedirectURI(requestedURI string) bool {
pkg/authserver/server/registration/client.go:73:func (c *LoopbackClient) GetMatchingRedirectURI(requestedURI string) string {
pkg/authserver/server/registration/client_test.go:43:func TestLoopbackClient_MatchRedirectURI(t *testing.T) {
pkg/authserver/server/registration/client_test.go:207:			result := client.MatchRedirectURI(tt.requestedURI)
pkg/authserver/server/registration/client_test.go:213:func TestLoopbackClient_GetMatchingRedirectURI(t *testing.T) {
pkg/authserver/server/registration/client_test.go:260:			result := client.GetMatchingRedirectURI(tt.requestedURI)
pkg/authserver/storage/cimd_decorator_test.go:385:		MatchRedirectURI(string) bool

The only non-definition hits are the methods' own unit tests in client_test.go and one anonymous-interface type-shape reference in cimd_decorator_test.go:385 (a compile-time interface literal, not an invocation).

Observed fact — fosite cannot call it either. ory/fosite v0.49.0 (the version pinned in go.mod) has no interface hook that would dispatch redirect matching to the client object: fosite.Client (fosite client.go:11) has no matcher method, and none of fosite's client extension interfaces — ClientWithSecretRotation, OpenIDConnectClient, ResponseModeClient (fosite client.go:40,47,75), ClientWithCustomTokenLifespans (fosite client_with_custom_token_lifespans.go:16) — declares one either. The authorization path that actually executes is:

  1. fosite.NewAuthorizeRequest validates the redirect via MatchRedirectURIWithClientRedirectURIs(rawRedirURI, request.Client) (fosite authorize_request_handler.go:180);
  2. which calls isMatchingRedirectURI over the plain client.GetRedirectURIs() string slice (fosite authorize_helper.go:99);
  3. whose loopback exception isMatchingAsLoopback (authorize_helper.go:117) requires isLoopbackAddress(requested.Hostname()) (authorize_helper.go:132-133);
  4. and isLoopbackAddress is net.ParseIP(hostname).IsLoopback() (authorize_helper.go:145-147) — false for the string localhost, because net.ParseIP("localhost") returns nil.

Interpretation (root cause). Wrapping a client in LoopbackClient changes nothing about redirect_uri validation, so the localhost half of the documented feature is dead code: the exact scenario the doc comment names — register http://localhost/callback, then request http://localhost:<dynamic port>/callback — is rejected by the code path that actually runs.

Observed live consequence. Claude Code registers via CIMD (client_id https://claude.ai/oauth/claude-code-client-metadata; that public document registers portless "redirect_uris": ["http://localhost/callback", "http://127.0.0.1/callback"]) and then requests authorization with redirect_uri=http://localhost:<random port>/callback. The authorize endpoint rejects it with invalid_request: "The 'redirect_uri' parameter does not match any of the OAuth 2.0 Client's pre-registered redirect urls." The asymmetry pins the diagnosis: the same client requesting the http://127.0.0.1:<port>/callback form passes fosite's native IP-literal loopback matching — the failure is specific to the localhost hostname, which is the form Claude Code actually sends.

Steps to reproduce

Live, against any deployment of the embedded auth server:

  1. Enable CIMD on the embedded auth server in front of any MCP server and add that server to Claude Code.
  2. Claude Code resolves its client metadata document and opens the authorization URL with redirect_uri=http://localhost:<random port>/callback.
  3. The authorize endpoint responds with the invalid_request error quoted above; the login never completes.

Deterministic and offline (no server, no Claude Code needed) — the harness below drives the real production objects (storage.NewCIMDStorageDecorator over storage.NewMemoryStorage(), resolving a *registration.LoopbackClient from a CIMD document that mirrors Claude Code's) and the real fosite matcher side by side. Save it as cmd/repro-loopback/main.go in a v0.41.0 checkout and run go run ./cmd/repro-loopback:

cmd/repro-loopback/main.go
// Command repro-loopback is a throwaway reproduction harness for the dead
// registration.LoopbackClient loopback-matching methods. It is NOT part of
// the ToolHive build; it exists only to drive the real production objects
// (the CIMD decorator, registration.LoopbackClient) and the real fosite
// matcher (fosite.MatchRedirectURIWithClientRedirectURIs) side by side, to
// prove that the RFC 8252 "localhost" loopback support the doc comment
// promises is never actually reached by the authorization code path.
//
// Run with: go run ./cmd/repro-loopback
package main

import (
	"context"
	"encoding/json"
	"errors"
	"fmt"
	"net/http"
	"net/http/httptest"

	"github.com/ory/fosite"

	"github.com/stacklok/toolhive/pkg/authserver/server/registration"
	"github.com/stacklok/toolhive/pkg/authserver/storage"
	"github.com/stacklok/toolhive/pkg/oauthproto/cimd"
)

func main() {
	fmt.Println("=== Step 1: serve a CIMD client metadata document (portless loopback redirect_uris) ===")

	// Mirrors Claude Code's real public CIMD document: portless loopback
	// redirect_uris. See the client_id
	// https://claude.ai/oauth/claude-code-client-metadata in the wild, which
	// registers exactly these two portless loopback URIs.
	mux := http.NewServeMux()
	srv := httptest.NewServer(mux)
	defer srv.Close()

	docPath := "/claude-code-client-metadata"
	mux.HandleFunc(docPath, func(w http.ResponseWriter, r *http.Request) {
		clientID := "http://" + r.Host + r.URL.Path
		doc := cimd.ClientMetadataDocument{
			ClientID: clientID,
			RedirectURIs: []string{
				"http://localhost/callback",
				"http://127.0.0.1/callback",
			},
		}
		w.Header().Set("Content-Type", "application/json")
		_ = json.NewEncoder(w).Encode(doc)
	})

	documentURL := srv.URL + docPath
	fmt.Printf("CIMD document served at: %s\n", documentURL)
	fmt.Println()

	fmt.Println("=== Step 2: build the CIMD decorator exactly as the server does, resolve the client ===")

	base := storage.NewMemoryStorage()
	defer func() { _ = base.Close() }()

	dec, err := storage.NewCIMDStorageDecorator(base, storage.CIMDDecoratorConfig{
		Enabled:      true,
		CacheMaxSize: 10,
		FallbackTTL:  0, // irrelevant for a single resolution in this harness
	})
	if err != nil {
		panic(fmt.Sprintf("NewCIMDStorageDecorator failed: %v", err))
	}

	ctx := context.Background()
	client, err := dec.GetClient(ctx, documentURL)
	if err != nil {
		panic(fmt.Sprintf("GetClient failed: %v", err))
	}

	fmt.Printf("Resolved client concrete Go type: %T\n", client)
	fmt.Printf("Resolved client ID:               %s\n", client.GetID())
	fmt.Printf("Resolved client redirect URIs:     %v\n", client.GetRedirectURIs())
	fmt.Println()

	loopbackClient, isLoopbackClient := client.(*registration.LoopbackClient)
	fmt.Printf("Is *registration.LoopbackClient:   %v\n", isLoopbackClient)
	fmt.Println()

	fmt.Println("=== Variant A: the Claude Code shape — http://localhost:<port>/callback via fosite's real matcher ===")
	fmt.Println("Calling fosite.MatchRedirectURIWithClientRedirectURIs(\"http://localhost:44821/callback\", client)")
	fmt.Println("(this is the exact function fosite.NewAuthorizeRequest calls at authorize_request_handler.go:180)")

	requestedA := "http://localhost:44821/callback"
	matchedA, errA := fosite.MatchRedirectURIWithClientRedirectURIs(requestedA, client)
	if errA != nil {
		fmt.Printf("Result: REJECTED\n")
		fmt.Printf("Verbatim error (%%v):    %v\n", errA)
		fmt.Printf("Verbatim error (%%+v):   %+v\n", errA)
		var rfcErr *fosite.RFC6749Error
		if errors.As(errA, &rfcErr) {
			fmt.Printf("  ErrorField:       %s\n", rfcErr.ErrorField)
			fmt.Printf("  DescriptionField: %s\n", rfcErr.DescriptionField)
			fmt.Printf("  HintField:        %s\n", rfcErr.HintField)
		}
	} else {
		fmt.Printf("Result: ACCEPTED (unexpected) — matched URL: %s\n", matchedA.String())
	}
	fmt.Println()

	fmt.Println("=== Variant B: IP-literal control — http://127.0.0.1:<port>/callback via fosite's real matcher ===")
	fmt.Println("Calling fosite.MatchRedirectURIWithClientRedirectURIs(\"http://127.0.0.1:44821/callback\", client)")

	requestedB := "http://127.0.0.1:44821/callback"
	matchedB, errB := fosite.MatchRedirectURIWithClientRedirectURIs(requestedB, client)
	if errB != nil {
		fmt.Printf("Result: REJECTED (unexpected)\n")
		fmt.Printf("Verbatim error: %v\n", errB)
	} else {
		fmt.Printf("Result: ACCEPTED via fosite's native loopback matching\n")
		fmt.Printf("Matched URL: %s\n", matchedB.String())
	}
	fmt.Println()

	fmt.Println("=== Variant C: what the dead LoopbackClient methods would have said, called directly ===")
	if !isLoopbackClient {
		fmt.Println("ERROR: resolved client is not a *registration.LoopbackClient; cannot run Variant C")
	} else {
		requestedC := "http://localhost:44821/callback"
		matchResult := loopbackClient.MatchRedirectURI(requestedC)
		matchingURI := loopbackClient.GetMatchingRedirectURI(requestedC)

		fmt.Printf("loopbackClient.MatchRedirectURI(%q)        = %v\n", requestedC, matchResult)
		fmt.Printf("loopbackClient.GetMatchingRedirectURI(%q)  = %q\n", requestedC, matchingURI)
		fmt.Println()
		fmt.Println("These two calls prove LoopbackClient's own RFC 8252 §7.3 \"localhost\" support")
		fmt.Println("WOULD accept the exact request that fosite.MatchRedirectURIWithClientRedirectURIs")
		fmt.Println("(Variant A, the function actually invoked by the production authorize code path)")
		fmt.Println("rejects. LoopbackClient.MatchRedirectURI / GetMatchingRedirectURI are never called")
		fmt.Println("by fosite or by any ToolHive production code path — see the git grep call-site proof in the bug description.")
	}

	fmt.Println()
	fmt.Println("=== Summary ===")
	fmt.Printf("Variant A (fosite matcher, localhost:port): rejected=%v\n", errA != nil)
	fmt.Printf("Variant B (fosite matcher, 127.0.0.1:port): rejected=%v\n", errB != nil)
	if isLoopbackClient {
		fmt.Printf("Variant C (dead LoopbackClient methods, localhost:port): MatchRedirectURI=%v\n", loopbackClient.MatchRedirectURI("http://localhost:44821/callback"))
	}
}

Expected behavior

Per RFC 8252 section 7.3 and per LoopbackClient's own documented and unit-tested semantics, an authorization request with redirect_uri=http://localhost:<port>/callback matches a registered portless http://localhost/callback (scheme, host, path, and query equal; any port allowed). Concretely: the Claude Code flow gets past /authorize, and the harness's Variant A is accepted — which is exactly what the shipped matcher answers when asked directly (Variant C: MatchRedirectURI returns true, GetMatchingRedirectURI returns the requested URI with its dynamic port preserved).

Actual behavior

Variant Call Result
A fosite.MatchRedirectURIWithClientRedirectURIs("http://localhost:44821/callback", client) — the exact function the production authorize path invokes Rejected: invalid_request, hint "The 'redirect_uri' parameter does not match any of the OAuth 2.0 Client's pre-registered redirect urls." — identical to the live failure
B Same call with "http://127.0.0.1:44821/callback" (IP-literal control) Accepted via fosite's native loopback matching; matched URL returned unchanged
C LoopbackClient.MatchRedirectURI / GetMatchingRedirectURI called directly with the Variant A URI true / "http://localhost:44821/callback" — the shipped matcher accepts exactly what the production path rejects, but nothing ever calls it

The %+v stack in the Variant A output additionally shows the error being created inside MatchRedirectURIWithClientRedirectURIs (fosite authorize_helper.go:81), confirming which matcher ran.

go run ./cmd/repro-loopback — full output (verbatim except the local username in file paths, which is redacted)
=== Step 1: serve a CIMD client metadata document (portless loopback redirect_uris) ===
CIMD document served at: http://127.0.0.1:52554/claude-code-client-metadata

=== Step 2: build the CIMD decorator exactly as the server does, resolve the client ===
Resolved client concrete Go type: *registration.LoopbackClient
Resolved client ID:               http://127.0.0.1:52554/claude-code-client-metadata
Resolved client redirect URIs:     [http://localhost/callback http://127.0.0.1/callback]

Is *registration.LoopbackClient:   true

=== Variant A: the Claude Code shape — http://localhost:<port>/callback via fosite's real matcher ===
Calling fosite.MatchRedirectURIWithClientRedirectURIs("http://localhost:44821/callback", client)
(this is the exact function fosite.NewAuthorizeRequest calls at authorize_request_handler.go:180)
Result: REJECTED
Verbatim error (%v):    invalid_request
Verbatim error (%+v):   invalid_request
github.com/ory/x/errorsx.WithStack
	C:/Users/<user>/go/pkg/mod/github.com/ory/[email protected]/errorsx/errors.go:41
github.com/ory/fosite.MatchRedirectURIWithClientRedirectURIs
	C:/Users/<user>/go/pkg/mod/github.com/ory/[email protected]/authorize_helper.go:81
main.main
	C:/Users/<user>/Projects/tmp-toolhive-v0410/cmd/repro-loopback/main.go:90
runtime.main
	C:/Users/<user>/go/pkg/mod/golang.org/[email protected]/src/runtime/proc.go:290
runtime.goexit
	C:/Users/<user>/go/pkg/mod/golang.org/[email protected]/src/runtime/asm_amd64.s:1771
  ErrorField:       invalid_request
  DescriptionField: The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.
  HintField:        The 'redirect_uri' parameter does not match any of the OAuth 2.0 Client's pre-registered redirect urls.

=== Variant B: IP-literal control — http://127.0.0.1:<port>/callback via fosite's real matcher ===
Calling fosite.MatchRedirectURIWithClientRedirectURIs("http://127.0.0.1:44821/callback", client)
Result: ACCEPTED via fosite's native loopback matching
Matched URL: http://127.0.0.1:44821/callback

=== Variant C: what the dead LoopbackClient methods would have said, called directly ===
loopbackClient.MatchRedirectURI("http://localhost:44821/callback")        = true
loopbackClient.GetMatchingRedirectURI("http://localhost:44821/callback")  = "http://localhost:44821/callback"

These two calls prove LoopbackClient's own RFC 8252 §7.3 "localhost" support
WOULD accept the exact request that fosite.MatchRedirectURIWithClientRedirectURIs
(Variant A, the function actually invoked by the production authorize code path)
rejects. LoopbackClient.MatchRedirectURI / GetMatchingRedirectURI are never called
by fosite or by any ToolHive production code path — see the git grep call-site proof in the bug description.

=== Summary ===
Variant A (fosite matcher, localhost:port): rejected=true
Variant B (fosite matcher, 127.0.0.1:port): rejected=false
Variant C (dead LoopbackClient methods, localhost:port): MatchRedirectURI=true

Environment (if relevant)

  • ToolHive v0.41.0 (tag commit d722304), embedded auth server with CIMD enabled (client_id_metadata_document_supported advertised)
  • ory/fosite v0.49.0 (per go.mod)
  • Observed live in a Kubernetes (operator + proxyrunner) deployment, but the defect is deployment-independent: the harness reproduces it in-process with the same objects and the same fosite function
  • Still present on main (baba8bf, checked 2026-08-04): LoopbackClient, NewLoopbackClient, MatchRedirectURI, and GetMatchingRedirectURI are unchanged in shape; GitHub code search still shows zero production call sites; no open PR wires the methods into the authorize path

Additional context

How this happened (file history of pkg/authserver/server/registration/client.go): the feature was built deliberately and never wired in.

Why the unit tests did not catch it: client_test.go invokes MatchRedirectURI/GetMatchingRedirectURI directly, so the tests pass while the feature is unreachable from the request path. An integration-level test that goes through fosite.NewAuthorizeRequest with a LoopbackClient and an http://localhost:<port> redirect_uri would have caught this and would guard a fix; the open CIMD integration-test PR #5379 looks like a natural home (its current plan covers authorize accepting a CIMD client_id, but not loopback dynamic-port matching).

Ask / proposed direction: wire the shipped matcher into the authorization path — for example, validate (and normalize, preserving the dynamic port) the redirect_uri via GetMatchingRedirectURI when the resolved client is a *registration.LoopbackClient, before or instead of fosite's static matcher; or alternatively contribute a redirect-matcher hook to ory/fosite. This is a request to connect the existing, deliberate, well-tested feature, not to redesign it. Happy to test a candidate fix against the live Claude Code flow.

Impact: with client_id_metadata_document_supported advertised, Claude Code selects CIMD automatically, so this defect makes the embedded auth server unusable for Claude Code out of the box.

Related (checked while looking for duplicates before filing):

Activity

  1. added
    needs-triage
    on Aug 4, 2026
  2. self-assigned this
    on Aug 5, 2026
  3. added
    bug
    and removed
    needs-triage
    on Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions