mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 11:15:54 +03:00
[GH-ISSUE #2815] Handling of non-canonical type bit maps #1069
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#1069
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?
Originally created by @divergentdave on GitHub (Feb 28, 2025).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2815
The
messagefuzzer currently ignoresCSYNCrecords. Removing this condition reveals that the type bit map may differ when decoding once, versus doing a decode-encode-decode round trip. This can happen when the type bit map includes window blocks in the wrong order, or multiple window blocks with the same block number. Record types are stored internally in aVec<RecordType>, and record types are added to the vector in the order they are seen on the wire. When encoding, the types get sorted and deduplicated, so the window blocks are written in the correct order. As a result, the two decodedCSYNCstructs are not equal to each other, since the first one's record types may include duplicates or be out of order.The same thing can happen with NSEC and NSEC3 records, which also contain type bit maps. We should enable a DNSSEC feature in the fuzzer in order to explore these record types further.
While RFC 4034 says "Blocks are present in the NSEC RR RDATA in increasing numerical order", we still need to decide how to handle records that do not conform. One approach would be to store record types in a
BTreeSet<RecordType>instead of aVec<RecordType>, in order to erase ordering and duplicates during decoding, instead of during encoding. This would resolve the fuzzer failures. However, this could potentially invalidate RRSIGs over such weird records, since the to-be-signed data is constructed from the re-encoding of the records.Avoiding re-encoding by saving a copy of the original RDATA sounds promising, but it has different implications for forwarding servers and for DNSSEC validation. Depending on the record type, DNSSEC may require some amount of canonical re-encoding to get rid of name compression and to use the canonical capitalization of names. For CSYNC, there are no names in the RDATA, but NSEC contains a next domain name as well. Maybe we should take a hybrid approach, where we store the original encoded form of the type bit map in RData-related structs, if available?