Skip to content

Keep other zones' records out of the additional section - #411

Merged
NelsonVides merged 1 commit into
mainfrom
fix/additional-in-zone
Nov 16, 2026
Merged

NelsonVides merged 1 commit into
mainfrom
fix/additional-in-zone

Conversation

@NelsonVides

Copy link
Copy Markdown
Contributor

erldns filled the additional section by looking up every NS and MX target in the whole zone cache, so a zone's answers carried the A and AAAA records of whichever zone held the names of its nameservers and mail exchangers. On a server that hosts zones for many parties, anyone who can add a zone for such a name gets their addresses sent along with someone else's answers, NS answers and referrals included. BIND, Unbound, PowerDNS Recursor and Knot Resolver all drop these records as out of bailiwick (RFC 5452 §6), so for them this was not a way into the cache, but there is no reason to send them.

Now only targets at or below the apex of the zone that answers get their addresses, the rule the resolver already applies when it follows a CNAME. Glue in referrals, and the records of a zone hosted below the apex, still come through: the section holds what a resolver would accept from it.

A zone whose nameservers are named in another domain, such as any zone served under a provider's own nameserver names, now answers NS with an empty additional section. Resolvers were discarding those records already and resolve the nameservers through their own zones, so nothing changes for them, and the responses get smaller.

dnstest's dnssec_ns expected example.com's records in the NS answer of minimal-dnssec.com. dnsimple/dnstest#53 dropped them, and the test profile here pins its merge commit. No other dnstest definition changed, and none of the PowerDNS regression tests expects addresses from outside the answering zone.

additional_holds_only_names_under_the_apex in resolver_SUITE covers NS answers, MX answers and referrals with a second zone in the cache, and fails on main. make test passes.

🔍 QA

Scenario: NS answer for a zone whose nameservers are in another zone

  • Run rebar3 ct --suite test/dnstest_SUITE once, so that the dnstest zones are in _build/test/lib/dnstest/priv/.
  • Copy erldns.example.config, set the zones path to "_build/test/lib/dnstest/priv/", and start a node with rebar3 as test shell --config <the copy>.
  • dig +norec @127.0.0.1 -p 8053 minimal-dnssec.com NS answers with ns1.example.com and ns2.example.com and no A or AAAA records in the additional section. On main it carries example.com's records for both.
  • dig +norec @127.0.0.1 -p 8053 example.com NS still carries the A and AAAA records of ns1.example.com and ns2.example.com, which are in the zone.

📋 Deployment Pre/Post tasks

  • POST: In the erldnsimple PR that moves to the erldns release with this change, also run mix deps.update dnstest: its integration suite runs dnssec_ns, and mix.lock holds dnstest at 9bfb1c1.

:shipit: Deployment Verification

  • Once erldnsimple ships the release, dig +norec @ns1.dnsimple-edge.com dnsimple.com NS returns no A or AAAA records for the dnsimple-edge.* nameservers in the additional section.

additional_processing/3 looked up each NS and MX target in the whole
zone cache, so an answer carried the A and AAAA records of whichever
zone held the target's name. On a server that hosts zones for many
parties, whoever could add a zone for the name of another zone's
nameserver or mail exchanger had their records sent along with that
zone's answers, NS answers and referrals included. Resolvers drop them
as out of bailiwick (RFC 5452 §6), but the server still sent them.

Only targets at or below the apex of the zone that answers are looked
up now, the rule follow/5 already applies to CNAME targets. Glue, and
the records of a zone hosted below this one, still come through. A zone
whose nameservers are named in another domain now answers NS with an
empty additional section.

dnstest's dnssec_ns expected example.com's records for the nameservers
of minimal-dnssec.com: the test profile now pins a dnstest commit that
expects none.

The new resolver_SUITE case covers NS answers, MX answers and
referrals, and failed before this change. make test passes.
@NelsonVides NelsonVides added the bug Code defect or incorrect behavior label Nov 16, 2026
@NelsonVides NelsonVides self-assigned this Nov 16, 2026
@NelsonVides
NelsonVides merged commit 27c9f9d into main Nov 16, 2026
9 checks passed
@NelsonVides
NelsonVides deleted the fix/additional-in-zone branch November 16, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Code defect or incorrect behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant