fix(daemon): refuse remote web commands that cannot enforce public-network-only

Merged
TH
8m ago
+221-11

Summary

A remote tenant request (internal publicNetworkOnly) cannot use the managed web browser on the daemon host, because that browser could reach the host's private network. A remote command that would use it is refused with UNSUPPORTED_OPERATION, reason REMOTE_WEB_PUBLIC_NETWORK_UNENFORCED, retriable: false. close stays allowed for cleanup. Local web sessions are unaffected.

The dispatch seam (runAdmitted) checks an existing session's device before composite resource admission, lease admission, the session journal and any handler. Device admission checks devices resolved later, such as a fresh open. The early check skips commands that do not use the session device: commands that ignore the session lease (devices, session_list, lease operations), and the new registry field detachedFromSessionDevice (artifacts, doctor --remote). capabilities and apps with an explicit device selector keep explicit-device precedence. This replaces the web part of #5272 and #5343.

Before / after

  • Remote snapshot on an existing web session: base runs it on the host browser; head refuses with REMOTE_WEB_PUBLIC_NETWORK_UNENFORCED before any handler.
  • Remote devices with a web session open: base and head list devices.
  • Local web snapshot: no observable change.

Validation

Head e43a25ebcd; CI pending.
pnpm vitest run packages/daemon/src/server/__tests__/request-router-web-sessions.test.ts: 30 passed. Removing the detached check fails 4 rows; removing the explicit-selector check fails 2; breaking the doctor field fails 1.
Production delta versus 0.22: about +53 lines. request-execution-scope.ts is 999 lines, under the 1000 cap.
Residual risk: no platform-web launch guard. publicNetworkOnly does not reach platform-web on 0.22.