feat(sidecars): egress binds 127.0.0.1 when EGRESS_LISTEN_HOST is set (PRD 0023 chunk 3) #68
Reference in New Issue
Block a user
Delete Branch "prd-0023-chunk-3-egress-bind-localhost"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Chunk 3 of PRD 0023 — the bind-address mitigation for TSI's IP-granular allowlist. The smolmachines guest's TSI allowlist is
<bundle-ip>/32: agent can reach that IP on any port. Without this change, the agent could dial<bundle-ip>:9099(egress's port) and bypass pipelock's DLP. Binding egress to localhost inside the bundle closes the gap at the socket level.Mechanism
egress_entrypoint.shreadsEGRESS_LISTEN_HOST. If set, it appends--listen-host <host>to mitmdump's argv.BundleLaunchSpec.environmentincludesEGRESS_LISTEN_HOST=127.0.0.1. Agent dials pipelock (<bundle-ip>:8888); pipelock's upstream is egress on bundle-localhost; egress is unreachable from outside the bundle.egress:9099directly via the docker network alias, so egress must remain externally accessible there.The asymmetry is by design and documented in the entrypoint script's comment.
Tests
tests/unit/test_egress_entrypoint.py): run the entrypoint script with a fakemitmdumpshim that prints its argv, assert the flag is present/absent under each env permutation (unset, empty,127.0.0.1, combined with upstream-proxy mode).test_smolmachines_launch) still pass: the egress-port-bypass probe preserves its property — chunk 2d ran withdaemons_csv=""so no egress was up; chunk 3 makes the property hold once egress IS up in chunk 4 (when real daemons land).545 unit + 3 integration tests passing locally.
What's left
CLAUDE_BOTTLE_BACKEND=smolmachines.