Commit Graph
2 Commits
Author SHA1 Message Date
viyatb-oai b0b0852ee0 Require port grants for Linux sandbox proxy bridges (#63775)
## Why

A managed network context with no loopback port grants could still
create host proxy bridges from proxy environment variables. The
managed network policy should determine which host ports the sandbox
can reach through those bridges.

## What changed

Authorize host proxy bridges against `loopbackPorts`. An empty list
creates no bridges, and a nonempty list rejects a route plan containing
an ungranted loopback endpoint. Transparent TCP routing still requires
a port grant.

Keep network access blocked when managed networking has no grants,
even with a full-access profile. Explicit local binding and Unix socket
permissions can still apply without a TCP proxy route.

## Testing

Extend route-planning and Linux sandbox tests to cover empty port lists,
ungranted endpoints, and local binding and Unix socket access without a
host proxy bridge.

GitOrigin-RevId: f048e9afa355c6ce87137c9ef1924c358ecae558
2026-11-25 00:12:21 +00:00
viyatb-oai 641b4cac88 Tie Linux sandbox proxy bridges to the launcher lifetime (#61898)
## Why

Host proxy bridges must close active connections when a sandbox exits or is cancelled. Proxy descriptor exhaustion must also leave synthetic mount cleanup able to run.

## What changed

- Run host proxy bridges as threads in an outer supervisor that forwards signals and preserves the sandbox command's exit status. Use parent-death signals to terminate supervised children when their parent exits.
- Give bridge routes private descriptor tables where supported, retry accepts after descriptor exhaustion, and keep mount cleanup in a separate supervisor.
- Create the transparent TCP namespace in the bubblewrap child after re-executing the sandbox helper, clearing inherited credentials from memory and restoring dumpability for user namespace ID mapping.

## Testing

Add regression tests for bridge teardown after normal exit, process-group cancellation, launcher termination, and caller-thread exit; exit status propagation with inherited `SIGCHLD` ignored; and SOCKS connectivity and synthetic mount cleanup under descriptor pressure.

GitOrigin-RevId: dd297af98e9383942098fab5683ef2474c5ae554
2026-11-16 22:27:42 +00:00