fix: use public origin for browser approval URLs - #1967
Open
utpalsinghdev wants to merge 2 commits into
Open
Conversation
CLI browser approval links ignored EXECUTOR_WEB_BASE_URL and inherited the internal HTTP listener scheme, so TLS-proxied deployments got unreachable http:// URLs.
CLI --port 0 installs EXECUTOR_WEB_BASE_URL as http://127.0.0.1:0 before the OS assigns a listen port. Chrome rejects that origin as ERR_UNSAFE_PORT, so approval URLs fall back to the request origin in that case.
utpalsinghdev
force-pushed
the
utpalsinghdev/approval-url
branch
from
September 8, 2026 18:26
57a31e5 to
1fcae95
Compare
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.
Summary
The CLI daemon listens over HTTP on loopback. Behind a TLS reverse proxy, browser approval responses built
approvalUrlfromrequest.url, so the scheme stayedhttp://even whenEXECUTOR_WEB_BASE_URLwas set to an HTTPS origin.createServerHandlers()already had that configured origin (and used it for artifact URLs).createMcpRequestHandler()did not. Self-host already preferswebBaseUrlinmakeInMemoryMcpSessionStore. This change threads an explicitEXECUTOR_WEB_BASE_URLinto the local handler the same way. When the env var is unset, the request origin is still used.Generated URLs follow
packages/core/sdk/src/public-origin.ts: the operator-set origin, notX-Forwarded-ProtoorHost.Linked issue
Closes #1954
Reproduction
executor daemon run --foreground --port 4788(HTTP on loopback).https://executor.example.test.POST https://executor.example.test/mcp?elicitation_mode=browser, initialize, thenexecutea tool covered byrequire_approval.structuredContent.approvalUrlishttp://…/resume/<execution-id>?mcp_session_id=…and does not open on an HTTPS-only listener.EXECUTOR_WEB_BASE_URL=https://executor.example.test, the approval URL origin is that HTTPS value. Resume path andmcp_session_idstay the same.The focused test sends the MCP request as
http://127.0.0.1:4788/mcp?elicitation_mode=browserand asserts the returned origin is the configured HTTPS public origin (including a non-default port). It also checks that path/query onEXECUTOR_WEB_BASE_URLare not inherited and thatX-Forwarded-Proto/X-Forwarded-Hostdo not override it.Verification
bunx --bun vitest run src/mcp-browser-resume.test.tsinapps/local: 2 passed. Before the production change the new case failed with originhttp://127.0.0.1:4788; after it,https://executor.example.test:8443.bunx --bun vitest runinapps/local: 17 files, 103 tests passed.bun run format:check: passed.bun run lint: passed.bun run typecheck: 45/45 packages passed.bun run test: failed on unrelated packages while turbo ran the workspace in parallel (@executor-js/host-cloudflareCloudflare Access e2e timed out at 5s). A local v1 to v2 SIGKILL migration test also failed under that load and passed when@executor-js/localwas run alone. There is no e2e scenario for a TLS-proxied CLI daemon; the local MCP integration test is the public-behavior coverage.Docs
apps/docs/local/cli.mdxnow documentsEXECUTOR_WEB_BASE_URLfor a TLS reverse proxy in front of the CLI daemon.