fix(server): fail-closed loopback bind + MCP loopback gate + strict CDP port (RVR-P1-001/003)#4
Merged
Conversation
… port Hardens the BrowserOS sidecar against LAN/container exposure (RVR-P1-001/003): - Bind 127.0.0.1 by default; a non-loopback interface is bound only under an explicit remote policy (mcpAllowRemote). Requesting a non-loopback host without it is now a fatal misconfiguration, not a silent 0.0.0.0 exposure. The discovery URL/logs already report loopback, so they now match reality. - requireTrustedOrigin is fail-closed: outside remote mode a caller that cannot be proven to be on the local socket is rejected (FORBIDDEN_NON_LOOPBACK), closing the missing-Origin / DNS-rebinding bypass on /mcp. Enforced whenever a server is bound (always in production); skipped only in test scaffolding. - resolveCdpPort fails closed on a malformed NDDEV_BROWSER_CDP_PORT instead of silently falling back to the embedded sidecar CDP endpoint. - isLocalhostRequest fails closed when no server binding is present. Tests: strict-port, non-loopback-reject, loopback-allow; server typecheck + lint clean; full server suite shows no regression vs baseline.
❌ Tests failed — 1/1422 failed
Failed tests
|
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.
Hardens the BrowserOS sidecar against LAN/container exposure.
Fixes
127.0.0.1; a non-loopback interface is bound only under an explicit remote policy (mcpAllowRemote), and requesting one without it is a fatal misconfig instead of a silent0.0.0.0exposure. Logs/discovery (already claiming loopback) now match reality. (P1-001)/mcpfail-closed —requireTrustedOriginnow rejects non-loopback callers outside remote mode (FORBIDDEN_NON_LOOPBACK), closing the missing-Origin / DNS-rebinding bypass. Enforced whenever a server is bound (always in prod). (P1-001)NDDEV_BROWSER_CDP_PORTfails closed instead of silently falling back to the embedded sidecar CDP endpoint. (P1-003)isLocalhostRequestfails closed with no server binding.Tests
New: strict non-numeric port, non-loopback reject, loopback allow.
@browseros/servertypecheck code 0; biome clean; full server suite: no regression vs baseline (same pre-existing env-dependent failures, +3 new passing).