mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 11:15:54 +03:00
[GH-ISSUE #254] Unclear parsing of RRSIG and SIG records #123
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#123
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 @briansmith on GitHub (Oct 24, 2017).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/254
The parsing code contains this:
It seems suspicious to me that the code for
RecordType::SIGandRecordType::RRSIGwould be identical. In particular, it seems strange to me that the distinction between SIG and RRSIG is lost here. I know nothing about DNS, so maybe this makes sense, but I think that at least there should be a comment here explaining why the code is OK.@bluejekyll commented on GitHub (Oct 24, 2017):
RRSIGrecords are identical toSIGrecords in their binary format. I like that the DNS RFC authors decided to do this. So I'm reusing the deserializer for both.There may have been some options in
SIGrecords that were deprecated inRRSIG, I can't think of any right now, but if we wanted to, we could pass some context into the read method, like theRecordTypebeing read to assert any differences as necessary.@briansmith commented on GitHub (Oct 24, 2017):
OK, that makes sense. But:
Why does the parser return a
RData::SIGfor RRSIGs instead of returning a hypotheticalRData::RRSIG? Doesn't the caller of the parser ever need to differentiate the two kinds?I suspect that maybe it is the case that, in a given context, either RRSIGs are valid, or SIGs are valid, but it's never the case that both SIGs and RRSIGs are allowed in the same record set. Is this the case? If so, shouldn't the parser be given a flag to indicate whether SIG or RRSIG is allowed?
@bluejekyll commented on GitHub (Oct 24, 2017):
For better or worse (you'll notice this in other
RDataimpls), there isn't a 1-1 relationship betweenRDatainner type variants andRecordType. At the moment, in all contexts where you useRData, you generally also have theRecordTypefor theRecordto know what innerRDatayou have.For example
RData::CNAME(Name),RData::NS(Name), andRData::PTR(Name)all wrapName, so they use the same deserializer for reading the binary for as each other: https://github.com/bluejekyll/trust-dns/blob/master/proto/src/rr/record_data.rs#L118SIGandRRSIGare using that same pattern. So the ActualRDatatype is the enum variant, which is strongly typed in theRecord: https://github.com/bluejekyll/trust-dns/blob/master/proto/src/rr/resource.rs#L70 . There is a 1-1 relationship betweenRDatavariants andRecordTypes.Now if your question is, why doesn't the
readmethod returnRDatainstead of the inner type, the answer to that lies in other types, which reuse the readers for some of these types such-asSOA: https://github.com/bluejekyll/trust-dns/blob/master/proto/src/rr/rdata/soa.rs#L215If you want to create an intermediary wrapper type like
RData::RRSIG(RRSIG(SIG))for clarity, I'd be open to that, but I guess I don't see a ton of value in that, unless that in some way decreases the potential of making some security mistake in terms of downgrade attacks and similar.@briansmith commented on GitHub (Oct 24, 2017):
Is it valid to have a recordset with both one or more RRSIGs and one or more SIGs? Or are they mutually exclusive within a given record set?
@bluejekyll commented on GitHub (Oct 24, 2017):
RecordSets should only be signed withRRSIGat this point.SIG(I'm pretty sure) is deprecated and only valid for use inSIG0signed Messages (dynamic update) operations.@bluejekyll commented on GitHub (Oct 27, 2017):
I'm going to close this unless there other issues. Let reopen if you believe there's unanswered questions here.
@briansmith commented on GitHub (Oct 27, 2017):
Not now. I think in the future we may get rid of the tests of
record_type()in favor of pattern matching on theRData::Sigconstructor, in which case we may need separateRData::SigandRData::RRSigconstructors? But not now. Thanks for the explanation!