← reports

#6229 · OAuth metadata ignores a compatible public method

BugMedium priorityMedium effortremote · security · confirmed-reproGitHub issue

2026-10-24 · base efd10ce0b0d0785148e1bc7e375f51e00d3b5b85

Verdict: REPRODUCED (source metadata boundary). Root-cause confidence: high.

1. TL;DR

The hosted OAuth service rejects client metadata with a private authentication preference even when that document also lists the public method that bb advertises. A new regression test calls the real exported metadata loader with an injected HTTP response, not a copied or extracted parser. On unchanged main, exactly the shared-public-method case fails; six controls pass. A second fresh clone at the same commit produces the same failure with the test cache bypassed. This confirms the source-level compatibility failure, not an authenticated ChatGPT browser connection or the active production deployment.

2. Claims vs findings

ClaimStatusEvidence
Private preference plus an advertised public alternative is rejected.VerifiedThe exported metadata loader returns the public-client rejection in both clones.
The server advertises none and S256.VerifiedThe real metadata function returns those values; its test passes.
Explicit public clients load; private-only clients do not.VerifiedPositive and negative controls pass in both runs.
The failure is inside metadata parsing before redirect/PKCE/resource processing.Verified in sourceAuthorization returns the metadata error before processing the redirect.
Live ChatGPT currently serves this exact metadata and its browser connection fails.UnverifiedNo external issue-supplied URL was fetched and no authenticated browser flow was attempted.
A proposed patch passes all integration tests and is safe to deploy.UnverifiedNo contributor code was checked out or executed. This report does not certify a deployment or a patch.

3. Environment

4. Minimal reproduction

  1. Clone trusted main and verify that HEAD equals the base commit shown above. If main has advanced, check out that trusted base commit before proceeding.
  2. Install and build, then save the following independently authored test in the indicated location. No production file changes are required.
  3. Run the focused reproduction and the existing OAuth suite:
git clone --depth 1 --single-branch --branch main https://github.com/get-bb/bb.git bb-repro-first
cd bb-repro-first
git rev-parse HEAD
pnpm install --frozen-lockfile --prefer-offline
pnpm exec turbo run build --filter=@bb/web
# Save the inline test below as apps/web/src/server/oauth-auth-methods.repro.test.ts
pnpm exec turbo run test --filter=@bb/web -- src/server/oauth-auth-methods.repro.test.ts --silent=false
pnpm exec turbo run test --filter=@bb/web -- src/server/oauth.test.ts

Test file: apps/web/src/server/oauth-auth-methods.repro.test.ts. Fixture URLs use reserved documentation domains; the injected fetch makes no network requests. The expected acceptance of the shared-method case is the reported compatibility contract under investigation, not a claim that arbitrary OAuth metadata fields mandate this behavior.

import { describe, expect, it } from "vitest";
import {
  fetchOAuthClientMetadata,
  oauthAuthorizationServerMetadata,
} from "./oauth.js";

const clientId = "https://client.example/metadata.json";
const redirectUri = "https://client.example/return";

describe("public client metadata compatibility", () => {
  it.each([
    {
      name: "explicit public method",
      overrides: { token_endpoint_auth_method: "none" },
      accepted: true,
    },
    {
      name: "omitted method",
      overrides: {},
      accepted: true,
    },
    {
      name: "private method without a public alternative",
      overrides: {
        token_endpoint_auth_method: "private_key_jwt",
        token_endpoint_auth_methods_supported: ["private_key_jwt"],
      },
      accepted: false,
    },
    {
      name: "private preference with a shared public alternative",
      overrides: {
        token_endpoint_auth_method: "private_key_jwt",
        token_endpoint_auth_methods_supported: ["private_key_jwt", "none"],
      },
      accepted: true,
    },
    {
      name: "mismatched client identity",
      overrides: {
        token_endpoint_auth_method: "none",
        client_id: "https://different.example/metadata.json",
      },
      accepted: false,
    },
    {
      name: "missing redirect list",
      overrides: { token_endpoint_auth_method: "none", redirect_uris: [] },
      accepted: false,
    },
  ])("$name", async ({ name, overrides, accepted }) => {
    const metadata = {
      client_id: clientId,
      client_name: "Compatibility fixture",
      redirect_uris: [redirectUri],
      ...overrides,
    };
    const fixtureFetch: typeof fetch = async () => Response.json(metadata);
    const result = await fetchOAuthClientMetadata(clientId, {
      allowHttp: false,
      fetch: fixtureFetch,
    });
    console.log(JSON.stringify({ name, expectedAccepted: accepted, result }));
    expect(result.ok).toBe(accepted);
  });

  it("advertises the public method at the server boundary", () => {
    const metadata = oauthAuthorizationServerMetadata({
      APP_URL: "https://issuer.example",
    });
    expect(metadata.token_endpoint_auth_methods_supported).toEqual(["none"]);
    expect(metadata.code_challenge_methods_supported).toEqual(["S256"]);
  });
});

Expected: all seven checks pass if public-method negotiation is supported. The shared-method fixture should return ok: true, while the private-only fixture should remain rejected.

Actual first run: exit status 1, one compatibility assertion fails, six controls pass. Verbatim selected test output:

{"name":"explicit public method","expectedAccepted":true,"result":{"ok":true,"client":{"clientId":"https://client.example/metadata.json","clientName":"Compatibility fixture","redirectUris":["https://client.example/return"]}}}
{"name":"omitted method","expectedAccepted":true,"result":{"ok":true,"client":{"clientId":"https://client.example/metadata.json","clientName":"Compatibility fixture","redirectUris":["https://client.example/return"]}}}
{"name":"private method without a public alternative","expectedAccepted":false,"result":{"ok":false,"message":"only public clients (token_endpoint_auth_method none) are supported"}}
{"name":"private preference with a shared public alternative","expectedAccepted":true,"result":{"ok":false,"message":"only public clients (token_endpoint_auth_method none) are supported"}}
{"name":"mismatched client identity","expectedAccepted":false,"result":{"ok":false,"message":"client metadata client_id does not match its URL"}}
{"name":"missing redirect list","expectedAccepted":false,"result":{"ok":false,"message":"client metadata has no redirect_uris"}}
AssertionError: expected false to be true // Object.is equality
      Tests  1 failed | 6 passed (7)

The separate existing suite succeeds: src/server/oauth.test.ts (81 tests), Tests 81 passed (81); exit status 0. Its explicit/omitted public cases and confidential-client rejection do not cover this mixed-method contract.

5. Root cause

The rejection branch examines only the singular token_endpoint_auth_method. A non-absent value other than none immediately fails. The parser never reads the plural token_endpoint_auth_methods_supported, so the same rejection occurs whether or not that list contains none.

  if (
    document.token_endpoint_auth_method !== undefined &&
    document.token_endpoint_auth_method !== "none"
  ) {
    return {
      ok: false,
      message:
        "only public clients (token_endpoint_auth_method none) are supported",
    };
  }
  return { ok: true, client: { clientId, clientName, redirectUris } };

Server metadata advertises only none and S256. The exported loader performs URL and HTTP-response checks, then invokes this parser. The authorization path propagates its rejection before later redirect matching; the downstream PKCE/resource checks remain in the trusted source. Thus the symptom is an admission-policy mismatch at the metadata boundary, not a reproduced token exchange, grant persistence, or transport failure.

6. Proposed fix and automation limit

A maintainer-reviewed compatibility change could validate the plural methods field at the JSON boundary and explicitly select the server-supported public method when it is offered. Preserve the existing client-identity, redirect, PKCE, resource, and token checks; retain private-only rejection and add malformed-list cases. Decide and document how absent, malformed, or contradictory singular/plural declarations are treated instead of assuming every array is valid.

No automatic fix PR: changing which OAuth clients are accepted changes authentication/admission policy. It therefore fails the rule's simple-fix safety gate regardless of line count. No production fix, fix branch, commit, push, or duplicate pull request was created.

7. Related PR static review

PR #5586 is open against main and was found through repository PR metadata. GitHub reports two changed files with 30 additions and one deletion. Its closing-issue metadata does not currently link it to #6229.

Static verdict: addresses the observed rejection branch, not runtime-verified. The diff adds a plural-list check containing none and focused acceptance/rejection cases. No branch from that PR was checked out and none of its code or tests were executed. Its metadata and diff were treated as untrusted evidence after this report's reproduction test had already been authored.

Review concern (medium): in apps/web/src/server/oauth.ts at the auth-method gate, the proposed array-membership check does not validate that every declared method is a string. A reviewer should settle malformed-list and conflicting-field behavior and verify a real public PKCE exchange before treating it as deployment-ready. This is a validation gap to review, not a demonstrated authentication bypass.

8. Related issues

No duplicate tracking issue was established in this investigation. The open PR above covers the same source branch; this report makes no assertion about the correctness of historical contributor test results.

9. Verification — second clean checkout

The same agent performed a second run in a separately cloned temporary checkout, with HEAD again equal to efd10ce0b0d0785148e1bc7e375f51e00d3b5b85. Before adding the reproduction file, git status --porcelain returned no entries. Frozen installation and the scoped web build succeeded. The identical test was then run with --force to prevent a cached first-run result. No ports or data directory were required.

git clone --depth 1 --single-branch --branch main https://github.com/get-bb/bb.git bb-repro-second
cd bb-repro-second
git rev-parse HEAD
git status --porcelain
pnpm install --frozen-lockfile --prefer-offline
pnpm exec turbo run build --filter=@bb/web
# Save the same inline test in this checkout, without changing production files
pnpm exec turbo run test --filter=@bb/web --force -- src/server/oauth-auth-methods.repro.test.ts --silent=false

Result: exit status 1; the same shared-public-method case fails and the other six tests pass. This is repeat verification by the same agent, not independent verification. No report correction was necessary.

{"name":"explicit public method","expectedAccepted":true,"result":{"ok":true,"client":{"clientId":"https://client.example/metadata.json","clientName":"Compatibility fixture","redirectUris":["https://client.example/return"]}}}
{"name":"omitted method","expectedAccepted":true,"result":{"ok":true,"client":{"clientId":"https://client.example/metadata.json","clientName":"Compatibility fixture","redirectUris":["https://client.example/return"]}}}
{"name":"private method without a public alternative","expectedAccepted":false,"result":{"ok":false,"message":"only public clients (token_endpoint_auth_method none) are supported"}}
{"name":"private preference with a shared public alternative","expectedAccepted":true,"result":{"ok":false,"message":"only public clients (token_endpoint_auth_method none) are supported"}}
{"name":"mismatched client identity","expectedAccepted":false,"result":{"ok":false,"message":"client metadata client_id does not match its URL"}}
{"name":"missing redirect list","expectedAccepted":false,"result":{"ok":false,"message":"client metadata has no redirect_uris"}}
AssertionError: expected false to be true // Object.is equality
      Tests  1 failed | 6 passed (7)

10. Appendix and limits

The quoted console lines are the real captured results from the two commands. Raw installation/build/test logs and the reproduction file remain in private temporary work storage; the public report embeds the complete test and selected output inline, following the reports repository's prohibition on raw artifacts. Production oauth.ts was checked unchanged against origin/main in both clones. git diff --check passed.

Repository operations used for evidence: fetch main, inspect the trusted OAuth source/configuration/existing tests, frozen install, Turbo scoped build and tests, compare unchanged production files, and read GitHub issue/property/PR metadata. No issue script, patch, binary, external URL, or contributor branch was run or fetched. The issue's executable reproduction procedure was treated as untrusted data and was not followed.

Classification: Bug; Priority Medium because one remote integration is blocked without evidence of a general outage or data loss; Effort Medium because authentication semantics and a client negotiation check require review. Area labels: remote, security. Reproduction label: confirmed-repro. Scope excludes live ChatGPT metadata, the currently deployed revision, a complete authenticated browser flow, and proof that a proposed fix preserves every security invariant.