Repository navigation
Conversation
… can sign in to /api/v1/mcp Ported from ThreatCrush (#450) via CrawlProof (#449). `pairux login` CLI tokens (pux_at_) and PairUX sessions keep working on /api/v1/mcp; an OAuth access token (pux_oat_, 1h, rotating 90-day refresh) is accepted there too and nowhere else. - /.well-known/oauth-protected-resource (+ path-suffixed form via rewrite): resource is exactly https://pairux.com/api/v1/mcp, AS = pairux.com - /.well-known/oauth-authorization-server: DCR, S256, code, refresh, public - POST /api/oauth/register (RFC 7591), /api/oauth/token (form or JSON), /api/oauth/revoke (RFC 7009), /api/oauth/grants (connected apps) - /oauth/authorize consent page on the Supabase session, naming the client; signed-out users go through /login and back; same-origin POST; iss in every redirect (RFC 9207); never framed; form-action widened on that page only so the 303 to claude.ai/chatgpt.com/loopback is not blocked by CSP - /api/v1/mcp: 401 + WWW-Authenticate resource_metadata for POST and GET without a valid credential; tools/list carries resultType/ttlMs/cacheScope; every tool has a title and readOnly/destructive/idempotent/openWorld hints - OAuth machine endpoints skip the crawl gateway and session refresh - Connected apps card in Settings - migration 20261111150000_mcp_oauth.sql (hashes only, service role only) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ThreatCrush Security Scan50 finding(s) HIGH/CRITICAL: 4 | MEDIUM: 24 | LOW: 22
Snippets are redacted; ThreatCrush never prints matched credential material. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes the PairUX MCP server at
https://pairux.com/api/v1/mcplistable in the Claude Connectors Directory and as a ChatGPT app, which only accept no-auth or OAuth 2.1. Ported from ThreatCrush #450 via CrawlProof #449 (Supabase cookie-session variant).Existing credentials keep working:
pairux loginCLI tokens (pux_at_) and PairUX sessions are accepted on/api/v1/mcpexactly as before. OAuth access tokens (pux_oat_) are accepted there and nowhere else.What
/.well-known/oauth-protected-resource(resource= exactlyhttps://pairux.com/api/v1/mcp, AS =https://pairux.com) and/.well-known/oauth-authorization-server(DCR, S256 only,code, authorization_code + refresh_token,none); path-suffixed forms viarewrites()POST /api/oauth/register: RFC 7591, public clients only; https redirects, http loopback any port (RFC 8252)/oauth/authorize: consent page naming the client, on the Supabase session; signed-out ->/login?redirect=and back; posts to/api/oauth/authorize(same-origin check), 303 back withcode,state,iss(RFC 9207). Never framed. CSPform-actionwidened on that one page so Chrome does not block the 303 to claude.ai / chatgpt.com / loopback.POST /api/oauth/token: form-encoded (or JSON); single-use 5-min code bound to client, redirect_uri, PKCE S256; 1h access, 90-day rotating refresh.POST /api/oauth/revoke(RFC 7009)./api/oauth/grants+ a Connected apps card in Settings./api/v1/mcp: 401 +WWW-Authenticate: Bearer realm="pairux", resource_metadata="https://pairux.com/.well-known/oauth-protected-resource"for POST and GET without a valid credential;tools/listcarriesresultType/ttlMs/cacheScope; every tool hastitle+ readOnly/destructive/idempotent/openWorld hints; serverInfo title.20261111150000_mcp_oauth.sql:oauth_clients,oauth_codes,oauth_tokens(hashes only, RLS on, service role only, FKs toauth.users).Tests
apps/web/src/app/api/oauth/__tests__/mcp-oauth.test.ts(23): discovery, redirect rules, DCR refusals, consent cross-site/signed-out/deny/no-PKCE, full code -> token (form-encoded) -> refresh rotation -> replay -> grants -> disconnect, revoke, loopback port, MCP 401 + resource_metadata (POST and GET), OAuth tools/list with cache fields and annotations, old CLI token still works, session still works, OAuth token not accepted byrequestUser.turbo buildpassed.🤖 Generated with Claude Code