fix(security): restrict Conductor browser origins - #741
Open
imMamdouhaboammar wants to merge 1 commit into
Open
Conversation
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
Fixes the browser-origin portion of upstream issue #726.
Conductor currently enables wildcard CORS for every HTTP route and accepts WebSocket handshakes without an Origin check. Because the desktop bridge starts Conductor on loopback without
--key, an unrelated webpage can reach127.0.0.1:8900and attempt to invoke Conductor HTTP APIs or open its WebSocket.The bundled desktop UI intentionally talks from port 14168 to Conductor on port 8900, so the policy must preserve trusted cross-port traffic on the same loopback host.
Changes
CORSMiddlewarewith a small ASGIBrowserOriginGuard127.0.0.1,localhost, or::1Origin: nullVary: Origin127.0.0.1:14168able to call and connect to Conductor on127.0.0.1:8900RemoteAuthbehavior and all subagent/API logicRegression coverage
The suite covers nine behaviors:
Origin: nullrejectionVerification
BrowserOriginGuard200 != 403before the loopback anchor was addedpython -m py_compile frontends/conductor.py tests/test_conductor_origin.py, the full regression suite, andgit diff --checkbefore commit31159379674passed the test job while every self-patching step was skipped, proving the committed code itself is greenNo new runtime dependency is introduced. FastAPI is already used by Conductor.
Scope and residual boundary
This PR intentionally addresses the browser-origin half of upstream #726. It does not change
RemoteAuth, which still does not require a key for default loopback callers. Adding a generated per-launch key affects the desktop bridge, Conductor HTTP and WebSocket clients, and the standalone browser UI, so it should be handled as a separate protocol-level contribution.Same-loopback-host browser content on another port remains trusted because the supported desktop UI itself uses that pattern. A per-launch secret is the appropriate follow-up if maintainers want to remove that trust assumption.
The connected GitHub integration has write access to this fork, but upstream write operations return
403 Resource not accessible by integration, so I cannot open the cross-fork PR tolsdefine/GenericAgentdirectly from this session.