mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 11:15:54 +03:00
[PR #3477] [MERGED] fix(recursor): require NS owner name to match zone in zone cut detection #3876
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#3876
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?
📋 Pull Request Information
Original PR: https://github.com/hickory-dns/hickory-dns/pull/3477
Author: @jackboykin
Created: 3/1/2026
Status: ✅ Merged
Merged: 3/9/2026
Merged by: @djc
Base:
main← Head:fix/recursor-zone-cut-detection📝 Commits (2)
52cbd8efix(recursor): check NS record owner name in zone cut detection6dbcffaMerge branch 'main' into fix/recursor-zone-cut-detection📊 Changes
4 files changed (+169 additions, -1 deletions)
View changed files
📝
conformance/e2e-tests/src/recursor/delegation/scenarios.rs(+90 -0)📝
conformance/test-server/src/handlers.rs(+77 -0)📝
conformance/test-server/src/main.rs(+1 -0)📝
crates/resolver/src/recursor/handle.rs(+1 -1)📄 Description
Found while swapping homelab from unbound to hickory (for RFC 9539 support). Twitter and Spotify were failing on my phone, I investigated thereafter.
Bug
The recursor queries for
api.x.com.NS records. The response doesn't include records for that name, but does include NS records forx.com.in the authority section. This is valid per RFC 2308 Section 2.2.ns_pool_for_name()then concludes thatapi.x.com.is a valid zone because it got NS records in the response. On a subsequent query it will haveapi.x.com.as the bailiwick, causing it to think the valid NS records forx.com.are out of scope:This produces SERVFAIL/NXDOMAIN for domains delegated through twtrdns.net (twitter.com, abs.twimg.com, etc.) and other servers with the same behavior (e.g. aaplimg.com).
Per RFC 1034 Section 5.3.3, resolvers should validate that a delegation is "closer" to the answer than the current servers. A parent NS record in a NODATA response is further away, not closer, and should not be treated as a zone cut. This matches Unbound's behavior, which uses
harden-glueand referral path validation to reject out-of-zone authority records.Fix
Before,
ns_pool_for_name()marked something as a zone cut if it got any NS records back. Now it checks if those NS records are actually for the queried zone.Name'sPartialEquses case-insensitive comparison per RFC 4343.Test plan
The e2e test uses a CNAME chain to make the bug observable:
deep.sub.example.testing. IN CNAME target.example.testing.with an inline A record. When the false zone cut narrows the bailiwick tosub.example.testing., thetarget.example.testing. IN Arecord is dropped by the bailiwick filter, causing CNAME following to fail. Without the false zone cut, all records pass the filter.parent_ns_in_authority_does_not_prevent_resolutionfails without fix (NXDOMAIN), passes with fix (NOERROR)hickory-resolverunit tests pass (77 pass, 1 pre-existing failure, 3 ignored)Disclosure
Bug discovered through real-world usage; fix and conformance test developed with assistance from Claude Code (Opus 4.6).
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.