fix(dns): refuse a --proxy host name instead of NODATA'ing every live name - #298
Merged
ralyodio merged 1 commit intoAug 5, 2026
Conversation
… name
A host name like `localhost` passes proxyReachable() (connect resolves it)
but isIP() cannot place it in an A/AAAA answer, so proxyAddress ends up
{v4:null, v6:null}. The mode then prints "proxying every live name ..." and
answers every live name with NODATA — the exact silent outage the
reachability gate exists to refuse. Reject a non-IP --proxy host up front
with a clear message, before any probe, for the same reason the gate does.
Adds a regression test (fails before / passes after).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
moshcode dns start --proxy <host>(#296) accepts a host name where it can only use an IP address, and the failure is silent.The bug
The parse takes any non-flag token after
--proxyas the host and hands it to the reachability gate:A name like
localhostpassesproxyReachable()becausenet.connect("localhost", 443)resolves and connects. But an A/AAAA answer can only carry an address, so:The command then prints
proxying every live name to localhost:443 — certificates are verified thereand, inaddressAnswer, every live name hitsforFamily = nulland returns NODATA. That is precisely the total silent outage ("the sites are down" whilediglooks healthy) that the reachability gate was added to refuse — it just walks straight past the gate for a host name.Reproduced against v0.22.1 driving the real
dnsCommand/addressAnswerexports: the CLI prints the success line, and a live name resolves to NODATA for both A and AAAA.The fix
Refuse a non-IP
--proxyhost up front, before any probe, with a clear message — the same "refuse rather than silently misconfigure" stance the gate below it already takes. IP hosts (--proxy 10.0.0.5) and the default loopback probe are unchanged.Tests
Adds
--proxy with a host name refuses instead of NODATA'ing every live nametotest/dns-proxy-mode.test.mjs. Fails before (name is accepted, no refusal), passes after. Full suite green: 1280 tests, 1066 pass, 0 fail, 214 skip.