Repository navigation
Let hosted agents connect to MCP with OAuth and an opt-in public URL (#1541) - #1603
Conversation
Solenta-Message-Id: a66b02fb-aacf-418c-96de-5f0d77a58cde
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 38a2bb916f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } catch (err) { | ||
| pairing.setPublicEnabled(ctx.userDataPath, false); |
There was a problem hiding this comment.
Preserve enabled state when Funnel shutdown fails
When the user stops public access and the Tailscale funnel ... off command fails, this catch persists publicEnabled: false even though the Funnel is still serving the endpoint. The app therefore records the user's exposure as disabled while the public route remains active, and a restart will not retry the requested shutdown; restore the previous enabled state on failure or persist the new state only after the CLI operation succeeds.
Useful? React with 👍 / 👎.
| const clients = loadClients(userDataPath); | ||
| if (clients.length >= MAX_CLIENTS) { | ||
| throw new Error(`At most ${MAX_CLIENTS} OAuth clients`); |
There was a problem hiding this comment.
Prevent public registrations from exhausting the client table
While Funnel is enabled, /register is unauthenticated, but every registration is persisted and there is no expiration, deduplication, or deletion path. Any remote caller can submit 40 valid registrations and permanently make all subsequent legitimate connector registrations fail with this limit until the user manually edits oauth-clients.json; prune stale clients or make the bounded registration state recoverable.
Useful? React with 👍 / 👎.
| createdAt: Date.now(), | ||
| }; | ||
| consents.set(id, pending); |
There was a problem hiding this comment.
Bound unauthenticated pending consent requests
A caller that registers one client can repeatedly request public /authorize URLs, and each request inserts a permanent entry into this process-global map and emits another desktop consent notification. Because pending entries have neither a TTL nor a count/rate limit and are removed only when the user explicitly approves or denies them, a remote caller can grow memory and the consent backlog without bound; expire and cap pending requests before inserting them.
Useful? React with 👍 / 👎.
| function approveConsent(userDataPath, id, grantInput, opts = {}) { | ||
| const pending = takeConsent(id); | ||
| const now = opts.now || Date.now(); | ||
| const created = pairing.createPairing( |
There was a problem hiding this comment.
Retain consent until grant creation succeeds
If createPairing fails after this call—for example because 20 active pairings already exist or the pairing file cannot be written—the pending consent has already been deleted. The dialog keeps displaying its local request, but both Allow and Deny then fail as unknown, while the hosted browser polls a 404 forever instead of receiving an OAuth redirect; remove the consent only after successful grant creation or restore it on failure.
Useful? React with 👍 / 👎.
Hosted agents (ChatGPT connectors, claude.ai) can now reach loopback
/mcpthrough opt-in Tailscale Funnel and sign in with OAuth 2.1 + PKCE. Closes the public-reachability half of #1541.Changes
/mcpon the public internet via Tailscale Funnel on HTTPS 8443 (so it does not fight Web Serve on:443). Off by default; the copy states the exposure as clearly as the existing Serve note. Copy public URL once Funnel is up./mcpaccepts the rotating in-app session token only when Host is loopback. A public Host gets 401 +WWW-Authenticateresource metadata and must present a pairing or OAuth bearer.Verification
node --test electron/test/mcp-oauth.test.js electron/test/pairing.test.js electron/test/pairing-ipc.test.js electron/test/webAccess.test.js electron/test/webScopes.test.js— 43 passed (OAuth, Funnel, pairing, scopes).test/oauthConsent.test.tsxand Settings integrations — passed.electron/test/orch-server.test.js(public Host rejects session token; OAuth grant can call/mcp) passed earlier in this worktree; could not re-run at the end because this checkout has nonode_modulesof its own and the sibling MCP SDK symlink vanished.Notes for reviewers
remoteAddressalways127.0.0.1. A spoofedHost: 127.0.0.1through Funnel would unlock the session token. Missing Host is no longer treated as loopback.httpredirect URIs must be loopback.:443will not reach Funnel on:8443. A hosted relay for machines without Tailscale is out of scope.cursor-grok-4.6 via Cursor
Made with Cursor