smolmachines: scope TSI allowlist to a per-bottle loopback alias (v2) #75
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
Context
The Docker-Desktop fix (PR #74) routes the smolmachines agent through
127.0.0.1:<host port>loopback forwards instead of the bundle's docker-bridge IP. Necessary because Docker Desktop's daemon runs inside its own Linux VM and bridge IPs aren't reachable from macOS networking.Side effect: the TSI allowlist is now
127.0.0.1/32, and TSI filters by IP only — no port granularity. So the agent VM can reach any service bound to macOS's loopback, not just the bundle's published ports: postgres on 5432, dev servers on 3000, other bottles' published ports, mDNSResponder, cupsd, etc. The docker backend keeps the bottle on a--internaldocker network and doesn't have this issue.See PRD 0023 open question #8 + the README "Smolmachines backend (experimental, macOS-only)" subsection for the full discussion.
Proposed fix
Bind each bottle's bundle ports on a per-bottle loopback alias (e.g.
127.0.0.2for bottle A,127.0.0.3for B), set TSI's allowlist to that single /32. Macros loopback aliases requireifconfig lo0 alias <ip>— sudo on macOS. Options:./cli.py smolvm-setup) that adds a reserved /28 of aliases (127.0.0.16..127.0.0.31) and assigns one per bottle from a pool.v2 candidate; v1 ships with the loopback widening documented.
Acceptance
<per-bottle-loopback-alias>/32, not127.0.0.1/32.127.0.0.1:<other-port>while the bottle is running.didericis-claude referenced this issue2026-05-27 16:23:35 -04:00
Resolved by #76. Each bottle now reserves a unique
127.0.0.16..127.0.0.31loopback alias, the bundle's port-forwards bind there, and the agent's TSI allowlist is the alias's/32. Smolvm 0.8.0 silently drops--allow-cidrwhen combined with--from, so the launcher patches smolvm's persistent state DB (~/Library/Application Support/smolvm/server/smolvm.db,vms.dataBLOB) betweenmachine createandmachine startto setallowed_cidrsdirectly — smolvm reads it on start and TSI enforces.End-to-end verified on Docker Desktop / macOS:
The DB-patch hack is tagged temporary — when smolvm honors
--allow-cidrwith--fromupstream,loopback_alias.force_allowlistbecomes a no-op call to remove.