Repository navigation
Conversation
The proxy's origin guard let through any request without an Origin header. A DNS-rebinding page reaches the proxy under the attacker's hostname, and its GET requests are same-origin, so the browser sends no Origin. That page could read /status, /bridge/health, /bridge/auth and /v1/models. Check the Host header first, and admit only localhost, IP literals and the configured bind host. Rebinding needs a hostname the attacker controls. Every legitimate client still passes: the sidecar, the schedule runtime, the status page, and a CLI that uses the seeded config. Also stop allowing every chrome-extension:// origin. Its only caller was the removed extension job queue, and the allowance let any installed browser extension call the proxy and read its responses.
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
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.
Issue for this PR
None. Follows the bridge review finding on the local WPP proxy. The proxy had no Host check, and it allowed every browser extension origin.
Companion PR: https://github.com/trmosala/CM-WPP-Bits/pull/3 ports the same fix to the extracted bridge package. That keeps the fix when the CookieMonster split removes
packages/desktop/src/main/wpp-bridge/from this repo.This PR overlaps #72 and #73 only in
AGENTS.md, and on different lines. This PR changes theproxy/server.mjsentry, #72 changes the normalizer entry, and #73 changes thesessionThreads.mjsentry. It doesn't overlap #74.Type of change
What does this PR do?
Two fixes in the request guard of
packages/desktop/src/main/wpp-bridge/proxy/server.mjs:Originheader. A DNS-rebinding page reaches the proxy under the attacker's hostname. ItsGETrequests are same-origin, so the browser sends noOrigin. That page could read/status,/bridge/health,/bridge/authand/v1/models.POSTrequests were already blocked, because they carry the attacker's hostname inOrigin. The proxy now checksHostfirst. It admits onlylocalhost, IP literals and the configured bind host, andstartServerWithActionspasses its real bind host to the check.chrome-extension://origin. Its only caller was the removed extension job queue, and the allowance let any installed browser extension call the proxy and read its responses. Those origins now get 403.The
proxy/server.mjsentry inAGENTS.mdnow describes both checks.Every current client still passes, because each one reaches the proxy through a loopback IP or
localhost. That covers the OpenCode sidecar, the schedule runtime, the status page, and a CLI that uses the seeded config.Behaviour change: with
O1_CODE_PROXY_HOST=0.0.0.0, a client that reaches the proxy through a machine name now gets 403. Such a client can use the machine's IP address, orO1_CODE_PROXY_HOSTcan be set to that name.Not in this PR: authentication. Any local process can still call
/v1/chat/completionsandPOST /bridge/login. A per-launch secret needs a separate design, because the schedule runtime, the status page and an external CLI have no way to receive one today.How did you verify your code works?
bun test src/main/wpp-bridge/frompackages/desktop: 505 pass, 0 fail. After a lint-only cleanup inisAllowedHost, I re-ranserver.test.mjsandserver-auth.test.mjs, and they pass (9 tests). The new tests check that:isAllowedHostadmitslocalhost, IP literals with or without a port, and the configured bind hostisAllowedHostrejects other hostnames,127.0.0.1.nip.io-style names, and hosts containing@,/or whitespaceisAllowedBrowserRequestrejects an extension originHostgets 403 on every read route, while127.0.0.1andlocalhoststill get 200POST /bridge/loginwith an extension origin gets 403 and doesn't open sign-inbun typecheckfrompackages/desktopand from the repo root (32 of 32 packages): pass.consistent-returnonreturn server) is on a line this PR doesn't change.server.test.mjsandAGENTS.mdare clean.server.mjsandserver-auth.test.mjsweren't Prettier-clean ondev, so they keep their existing style.bun test(467),bun typecheckandbun run build:typesin CM-WPP-Bits.Screenshots / recordings
Not a UI change.
Checklist