Files
codex/codex-rs/tcp-tunnel
richardopenai 98323eddf9 Simplify SSH tunneling and honor system HTTPS proxies (#61975)
## What changed

- Make `codex tcp-tunnel` an SSH stdio helper, removing the loopback listener, stdin control protocol, and JSON diagnostics.
- Add `--token-file` for one-use credentials, consumed only after gateway verification, with environment-based OAuth routing or a legacy IPv4 `--target`.
- Honor system HTTPS proxy settings without attempting direct QUIC, and keep gateway credentials inside verified TLS.
- Race direct TCP addresses through TLS and HTTP/2 readiness so stalled peers do not block a working address.

## Testing

Add coverage for proxy credential isolation and stalled TLS peers, plus an opt-in Linux OpenSSH integration test for complete uploads and remote exit while local stdin remains open.

GitOrigin-RevId: 62423c8a8267842c9e401b3f9094c7278c47a490
2026-11-17 06:03:45 +00:00
..

SSH portal transport

Use codex tcp-tunnel --environment-id ENV as an OpenSSH ProxyCommand. The helper prefers QUIC/HTTP/3, starts TLS/HTTP/2 after 250 ms, and selects the first authenticated CONNECT accepted by the verified gateway. A single ten-second setup deadline covers transport, credential retrieval, and admission. SSH bytes are never replayed across transports.

When standard HTTPS proxy settings select a proxy, the helper uses that route without attempting direct QUIC. It honors HTTPS_PROXY, ALL_PROXY, NO_PROXY, and supported OS proxy configuration, tunnels to the gateway, and verifies the gateway's TLS certificate before sending the admission credential. Direct TCP races resolved addresses through TLS and HTTP/2 readiness.

Desktop uses the same stdio path with a one-use --token-file in a private directory. OAuth uses the environment ID and published port; legacy JWT admission additionally uses --target IP:PORT. The helper reads and removes the token file only after verifying the gateway. SSH owns each helper process; multiplexing belongs to OpenSSH ControlMaster.

On Linux, run codex-rs/tcp-tunnel/tests/real-ssh.sh to verify a complete upload and a remote exit with local stdin still open through a real OpenSSH server and HTTP/3 tunnel. It requires OpenSSH, Python, timeout, and the normal Rust test tools.