mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 03:05:51 +03:00
[GH-ISSUE #1353] Resolver claims network is unreachable when iodef URL parsing bails #654
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#654
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 @saethlin on GitHub (Jan 12, 2021).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/1353
Observed on released trust-dns-proto/resolver 0.20.0 and
8f1a8eeff8This parsing failure of a probably-invalid iodef eventually causes the resolver to report that the network is unreachable, which seems pretty wrong to me. Ideally I would like to be able to see the bytes that failed to parse as a URL, but the resolver should definitely report the correct problem, and I'd really like to be able to see the rest of the parsed Message, perhaps with the malformed record missing. I'm willing to contribute a patch to fix this if you can offer some guidance.
Offline reproducer:
Online reproducer:
@djc commented on GitHub (Jan 13, 2021):
You might try turning on the logs for your online reproducer and see what it comes up with (use env_logger and tune it all the way up to DEBUG). I suspect this might be hitting the code at https://github.com/bluejekyll/trust-dns/blob/main/crates/proto/src/udp/udp_client_stream.rs#L249, but am not sure.
@saethlin commented on GitHub (Jan 13, 2021):
Sure looks like it.
@djc commented on GitHub (Jan 13, 2021):
What kind of guidance are you looking for as to improving the situation here? I'm not sure what the relevant specs have to say about returning partial messages up to the caller, and in general Rust error handling gets a little cumbersome when you have both a result and some validation error. There may also be good reasons to just drop invalid messages in favor of potentially trying again, though trust-dns could potentially be more principled about how this is handled.
@bluejekyll commented on GitHub (Jan 13, 2021):
I suppose we could make the URL parsing lazy instead of eager. We could store the URL as bytes (assuming the character-data is well-formed) and then have lazy URL parsing on the get for the field. That way message processing wouldn't fail, but you'd still know that field is a malformed URL on access.
@bluejekyll commented on GitHub (Jan 13, 2021):
In terms of better error reporting, that might be possible? It's tough though, since we're dropping the entire message (including the id) on a parse failure. Maybe we could pull out the message Header separately from the entire Message, and that would allow for some additional matching of returned malformed Response to the Request.
@saethlin commented on GitHub (Jan 13, 2021):
Trust already reports partial messages to the caller, using
RData::Unknown. That's probably the wrong tool here, but there's precedent for partial success.I'd prefer the error reporting to be more accurate, even if no data from the message is reported. The network wasn't unreachable, that's just a lie. We got a message, but it didn't parse, and we tried again. Can the resolver report that?
@bluejekyll commented on GitHub (Jan 13, 2021):
See my comment on the error reporting. Of course it can be better. The challenge is that to fix that, we need to build in support to get the partial message associated back to the request, and return that.
Basically, it’s work :)
@divergentdave commented on GitHub (Mar 31, 2025):
I agree that we should defer parsing the
iodefvalue as a URL. Themessagefuzzer has found a CAA record that does not round-trip successfully due to this field.Similarly, any canonicalization that the
Urltype does may cause signature verification failures.