Skip to content

fix(server): fail-closed loopback bind + MCP loopback gate + strict CDP port (RVR-P1-001/003)#4

Merged
rldyourmnd merged 1 commit into
mainfrom
fix/fail-closed-server-hardening
Jul 23, 2026
Merged

fix(server): fail-closed loopback bind + MCP loopback gate + strict CDP port (RVR-P1-001/003)#4
rldyourmnd merged 1 commit into
mainfrom
fix/fail-closed-server-hardening

Conversation

@rldyourmnd

Copy link
Copy Markdown

Hardens the BrowserOS sidecar against LAN/container exposure.

Fixes

  • Loopback bind by default — server binds 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 silent 0.0.0.0 exposure. Logs/discovery (already claiming loopback) now match reality. (P1-001)
  • /mcp fail-closedrequireTrustedOrigin now 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)
  • Strict CDP port — a malformed NDDEV_BROWSER_CDP_PORT fails closed instead of silently falling back to the embedded sidecar CDP endpoint. (P1-003)
  • isLocalhostRequest fails closed with no server binding.

Tests

New: strict non-numeric port, non-loopback reject, loopback allow. @browseros/server typecheck code 0; biome clean; full server suite: no regression vs baseline (same pre-existing env-dependent failures, +3 new passing).

… 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.
@github-actions github-actions Bot added the fix label Jul 23, 2026
@github-actions

Copy link
Copy Markdown

❌ Tests failed — 1/1422 failed

Suite Passed Failed Skipped
agent 282/282 0 0
build 32/32 0 0
⚠️ claw-app 0/0 0 0
⚠️ claw-onboard 0/0 0 0
claw-server 0/1 1 0
eval 91/91 0 0
server-agent 301/301 0 0
server-api 135/135 0 0
server-browser 10/10 0 0
server-integration 10/10 0 0
server-lib 265/266 0 1
server-root 37/40 0 3
server-tools 254/254 0 0
Failed tests
  • claw-serverworkflow > claw-server setup

View workflow run

@rldyourmnd
rldyourmnd merged commit 0e86aa6 into main Jul 23, 2026
28 of 34 checks passed
@rldyourmnd
rldyourmnd deleted the fix/fail-closed-server-hardening branch July 23, 2026 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant