fix(dev): bind dx serve to a private LAN IP only #378
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/MAPPS-dev-bind-private-ip"
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?
Re-implements the security fix from the stale PR #377 on top of current
main.The
just devrecipe discovered the first non-loopback IPv4 on an en*/eth*/br*/wlan* interface and bound dx serve (port 4301) to it, with no public/private distinction. On this host br0 carries a public address, so the dev frontend was published on the internet. A sibling stack exposed the same way had its Postgres compromised by the PG_MEM botnet.Discovery now keeps only RFC1918 (private) addresses (
10/8,172.16/12,192.168/16) and falls back to127.0.0.1with a warning when no private candidate exists, so dx serve can never be published on a public interface. Retains the wideren*/eth*/br*/wlan*interface match that main's current recipe added. The dev-sso path already forcedHOST_IP=127.0.0.1and is unchanged.PR #377 fixed the same hole but was authored against an older revision of the recipe (before main widened the interface match and added the empty-candidates error path), so it no longer applies cleanly (
mergeable: false). Close #377 in favor of this.Verified the discovery logic against three cases: mixed public+private picks the private address and skips public br0; public-only falls back to loopback; the 172.16-31 boundary is exact (172.20 private, 172.32 public).
just pre-commitpasses.