Public: anyone can read this; the crew can change it.

Inside a child cell, the looks browser cannot reach the child's own app (net::ERR_INTERNET_DISCONNECTED) #10615

Parked opened this in answer to
Closed without merging

Inside a child cell, the looks browser now dials 127.0.0.1 on the app's port and sends the app's own hostname as the Host header. I couldn't run Chromium here, so I haven't seen a real picture come out of a cell. bun x tsc --noEmit and the three new tests pass, and bun scripts/gate.ts printed no errors.

Notes

stopped parked by the crew deploy 013ad25

opened this

Inside a child cell, the looks browser now dials 127.0.0.1 on the app's port and sends the app's own hostname as the Host header. I couldn't run Chromium here, so I haven't seen a real picture come out of a cell. bun x tsc --noEmit and the three new tests pass, and bun scripts/gate.ts printed no errors.

The cause (inferred, not reproduced). The cell's network is loopback only, and I believe Chromium treats that as offline. I think any hostname it has to resolve fails with net::ERR_INTERNET_DISCONNECTED, even one mapped to 127.0.0.1 by --host-resolver-rules. The port was already local. I couldn't confirm the Chromium behaviour from here.

What changed. The fix is in src/looks/capture.ts. A new targetFor(url, inCell) picks the address, and the cell is detected the way apps/egress.ts already does it (upstreamProxy() is set).

  • Inside a cell: the browser navigates to 127.0.0.1:<port>, and the Host header is set through DevTools for every request. The page is checked against 127.0.0.1, and the host-resolver rule is dropped.
  • Outside a cell: behaviour is unchanged.
  • Network: the cell gains none. --no-proxy-server stays, and the only destination is loopback.

Tests. test/look-cell-target.test.ts has three cases:

  • Outside a cell, the host is mapped.
  • Inside a cell, the target is the loopback address with the Host header and no resolver rule.
  • Against a real loopback server, the cell target reaches the app and the server sees the app's hostname.

Not covered. There is no end-to-end test that a cell child gets a picture of its own app, because that needs a Chromium that can run inside a cell. Three tests in test/looks.test.ts that launch the real browser fail here with process_singleton_posix.cc: socket() failed: Operation not permitted, on main too. The forge's check runs them. If Chromium still reports offline with the loopback address and the Host header, the next thing to try is a proxy-style navigation.

Closes #10557

3 earlier comments
commented

Inside a child cell, the looks browser now dials 127.0.0.1 on the app's port and sends the app's own hostname as the Host header. I couldn't run Chromium here, so I haven't seen a real picture come out of a cell. bun x tsc --noEmit and the three new tests pass, and bun scripts/gate.ts printed no errors.

The cause (inferred, not reproduced). The cell's network is loopback only, and I believe Chromium treats that as offline. I think any hostname it has to resolve fails with net::ERR_INTERNET_DISCONNECTED, even one mapped to 127.0.0.1 by --host-resolver-rules. The port was already local. I couldn't confirm the Chromium behaviour from here.

What changed. The fix is in src/looks/capture.ts. A new targetFor(url, inCell) picks the address, and the cell is detected the way apps/egress.ts already does it (upstreamProxy() is set).

  • Inside a cell: the browser navigates to 127.0.0.1:<port>, and the Host header is set through DevTools for every request. The page is checked against 127.0.0.1, and the host-resolver rule is dropped.
  • Outside a cell: behaviour is unchanged.
  • Network: the cell gains none. --no-proxy-server stays, and the only destination is loopback.

Tests. test/look-cell-target.test.ts has three cases:

  • Outside a cell, the host is mapped.
  • Inside a cell, the target is the loopback address with the Host header and no resolver rule.
  • Against a real loopback server, the cell target reaches the app and the server sees the app's hostname.

Not covered. There is no end-to-end test that a cell child gets a picture of its own app, because that needs a Chromium that can run inside a cell. Three tests in test/looks.test.ts that launch the real browser fail here with process_singleton_posix.cc: socket() failed: Operation not permitted, on main too. The forge's check runs them. If Chromium still reports offline with the loopback address and the Host header, the next thing to try is a proxy-style navigation.

commented

Inside a child cell, the looks browser now dials 127.0.0.1 and sends the app's hostname as the Host header, but only when the URL has a name in it. I couldn't run Chromium here (it fails on a socket error in this sandbox), so I haven't seen a real picture come out of a cell, and the check's last run was red.

The fix for the failing tests. The first version also rewrote URLs that were already 127.0.0.1, adding the Network.enable and Host-header path. That is the likely reason the "error page" and "dark capture" tests failed in the check, since both use 127.0.0.1 URLs. targetFor in src/looks/capture.ts now leaves an IPv4 or bracketed-IPv6 address exactly as it was before this pull, in a cell or out of one.

The risk. I haven't confirmed that the "real capture through the grant door" test passes. Its URL is a named host, so in a cell it still takes the new path (loopback address plus Host header). If the forge's check still fails that one test, the fault is in that path, and I'd want its error text.

What changed. src/looks/capture.ts gets the address check, and test/look-cell-target.test.ts gets a test that an address stays as it is in a cell. That file's four tests, bun x tsc --noEmit and bun scripts/gate.ts pass.

Not done. I added no end-to-end cell test, because a cell can't be built in this sandbox.

commented

The real-capture test is still red, and I haven't fixed it. I couldn't find the cause from here, so this push only makes the failure readable.

  • Where it fails. The previous push fixed the other two Chromium tests, which use 127.0.0.1 URLs. The one left is "a real capture through the grant door". Its URL has an app hostname in it, so in a cell it takes the new path: the browser dials 127.0.0.1 and sends the app's hostname as the Host header.
  • What I checked. I read grant, openEnvUrl and originFor in src/apps/proxy.ts and src/actions/apps.ts. The grant door answers with a relative 303 and sets the cookie, so nothing there obviously breaks on a loopback address. That leaves the Host-header override or the cookie handling on 127.0.0.1 as the suspects, and I can't tell which from here.
  • What I changed. The test now compares the whole capture result instead of only ok, so a failing check log will name the reason. That change is in test/looks.test.ts.
  • What I couldn't run. Chromium won't start in my sandbox (socket() failed: Operation not permitted). The check is the only place this test can run.
  • Next step. Read the reason in the check log for this push and fix that. If it is the Host override, the fallback to try is sending the browser through a proxy-style request to the forge's listener.
commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs