Route desktop remote bootstrap auth through Electron main process#2036
Route desktop remote bootstrap auth through Electron main process#2036r1sk01 wants to merge 2 commits intopingdotgg:mainfrom
Conversation
Co-authored-by: OpenAI Codex <codex@openai.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-authored-by: OpenAI Codex <codex@openai.com>
ApprovabilityVerdict: Needs human review This PR adds a new IPC channel for routing HTTP requests through Electron's main process, directly affecting authentication flows (bearer session bootstrap, session state, WS tokens). Changes that add network capabilities and touch auth code paths require human review regardless of diff size. You can customize Macroscope's approvability policy. Learn more. |
What Changed
Routes desktop remote bootstrap/auth JSON requests through Electron main-process IPC instead of issuing them from the renderer.
Adds the preload bridge, main-process handler, shared IPC contract updates, and tests covering the desktop path while leaving the normal web flow unchanged.
Why
Fixes #1928.
Desktop remote pairing was failing when the remote server did not allow the desktop renderer origin via CORS, because the environment bootstrap/auth flow was being performed directly from the renderer.
Handling those requests in the Electron main process removes the renderer CORS dependency without widening the change into the regular browser path.
Checklist
Note
Medium Risk
Introduces a new IPC surface that can issue arbitrary
http(s)GET/POST requests from the Electron main process, which increases SSRF/network-access risk if misused despite basic validation.Overview
Remote environment bootstrap/auth JSON requests in Electron are now proxied through the main process instead of using renderer
fetch, avoiding CORS failures against remote servers.This adds a new
desktop:request-json-httpIPC endpoint (exposed asdesktopBridge.requestJsonHttp) with request validation in the main process and updatesfetchRemoteJsonto prefer this bridge when present, plus associated contract/type updates and test stubs/coverage for the Electron path.Reviewed by Cursor Bugbot for commit ae72c23. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Route remote bootstrap auth requests through the Electron main process
requestJsonHttpIPC channel (desktop:request-json-http) handled in the Electron main process, supporting GET/POST with optional headers and body, returning status, ok, and body text.DesktopBridgeinpackages/contracts/src/ipc.tswithDesktopJsonHttpRequestandDesktopJsonHttpResponsetypes, and exposesdesktopBridge.requestJsonHttpto the renderer via the preload context bridge.fetchRemoteJsoninapps/web/src/environments/remote/api.tsto route throughdesktopBridge.requestJsonHttpwhen running in Electron, falling back towindow.fetchin browser contexts.fetchRemoteJsonnow reads body text and HTTP status from the bridge response rather than from the fetchResponseobject directly.Macroscope summarized ae72c23.