mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 11:15:54 +03:00
[PR #2774] [MERGED] Fix NSEC3 validation's logic for covering records #3306
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#3306
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/2774
Author: @divergentdave
Created: 2/12/2025
Status: ✅ Merged
Merged: 2/13/2025
Merged by: @divergentdave
Base:
main← Head:david/nsec3-covers-fix📝 Commits (3)
1982b83Store base32-encoded next hashed name in NSEC33024269Replace Nsec3Base32Hash with Labela75bf49NSEC3 validation: Fix find_covering_record()📊 Changes
2 files changed (+106 additions, -86 deletions)
View changed files
📝
crates/proto/src/dnssec/dnssec_dns_handle/nsec3_validation.rs(+45 -83)📝
crates/proto/src/dnssec/rdata/nsec3.rs(+61 -3)📄 Description
The
find_covering_record()helper function in the NSEC3 validation code is incorrect because it always returns something when given a nonempty set of NSEC3 records. This PR removes the fallback inor_else()and instead adds a separate case to handle the last NSEC3 record in a zone. RFC 5155 says "The value of the Next Hashed Owner Name field in the last NSEC3 RR in the zone is the same as the hashed owner name of the first NSEC3 RR in the zone in hash order", so we need to test that the target hashed owner name is in the wrap-around range between the two hashed names represented by the record.To detect which case the NSEC3 record falls in, we need to compare a base32-encoded hashed owner name from the record's name and the next hashed owner name from the RDATA, which is a raw digest. Thus, I added a field to the
NSEC3struct that stores the base32 encoding of the next hashed owner name, so it can be compared directly. I also replaced the recently introducedNsec3Base32Hashstruct, used for case-insensitive comparisons, withLabel, which has the same comparison semantics and is already used elsewhere.I haven't written a test case for this yet, I might try to cobble together one from the zone signing utilities and a dnslib server.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.