Peering client dials port 443 for plain-HTTP peer URLs without an explicit port #140
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
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?
Found live during the first real A↔B dogfood transfer (#106). Sending from
cairn-encto a peer registered ashttp://192.168.10.247fails:Root cause:
Client.dialpassesu.Hoststraight togrpc.NewClient. For a URL without an explicit port,u.Hosthas no port, and gRPC's default resolver appends 443 regardless of scheme — the insecure-credentials branch changes the transport security but not the target port. So every plain-HTTP LAN peer (exactly the caseisPrivateHostdeliberately permits) dials 443 unless the admin happens to write:80.Why tests missed it: the loopback test injects
Client.Dial(in-process listener), so the URL→target derivation was never exercised against a real address.Fix: derive the target explicitly — port from the URL if present, else 80 for
httpand 443 forhttps— in a smallgrpcTarget(u)helper with a unit test over the four cases (both schemes × with/without explicit port).Same patch transparently fixes the reverse direction (beta→enc) and any future LAN peer.