[GH-ISSUE #2010] Failing to read "_acme-challenge" TXT record #848

Closed
opened 2026-03-16 00:32:53 +03:00 by kerem · 6 comments
Owner

Originally created by @lpotthast on GitHub (Aug 28, 2023).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2010

I'm trying to check that an _acme-challenge TXT record is available by performing a txt_lookup call. The library returns the following error even if only that _acme-challenge record is available.

ResolveError { kind: Proto(ProtoError { kind: Msg("Label contains invalid characters: Err(Errors { invalid_mapping, disallowed_by_std3_ascii_rules })

Why?

Additionally: txt_lookup returns Result<TxtLookup, ResolveError> with TxtLookup being iterable but immediately returns an error when simply one of multiple available TXT records is incorrect. Why am I not allowed to iterate overall other records which are/would be correct in the view of this library?

Is there any "insecure" or "unsafe" way to still see get the raw values read?

Are there some configuration parameters I am missing?

Originally created by @lpotthast on GitHub (Aug 28, 2023). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2010 I'm trying to check that an `_acme-challenge` TXT record is available by performing a `txt_lookup` call. The library returns the following error even if only that `_acme-challenge` record is available. ``` ResolveError { kind: Proto(ProtoError { kind: Msg("Label contains invalid characters: Err(Errors { invalid_mapping, disallowed_by_std3_ascii_rules }) ``` Why? Additionally: `txt_lookup` returns `Result<TxtLookup, ResolveError>` with `TxtLookup` being iterable but immediately returns an error when simply one of multiple available TXT records is incorrect. Why am I not allowed to iterate overall other records which are/would be correct in the view of this library? Is there any "insecure" or "unsafe" way to still see get the raw values read? Are there some configuration parameters I am missing?
kerem 2026-03-16 00:32:53 +03:00
Author
Owner

@djc commented on GitHub (Aug 28, 2023):

We were just discussing similar issues in #2009. Are you suggesting this might be a regression in the 0.23.0 release?

This is an error from the idna crate. I'm not exactly sure where/why that is being called here. Unfortunately I won't have much time to investigate, but I'm happy to support you if you have a chance to dig in.

I do agree that it would probably make sense that TxtLookup should allow you to iterate over records independently of whether a specific record doesn't validate. Would you be able to send a PR for that?

<!-- gh-comment-id:1695513661 --> @djc commented on GitHub (Aug 28, 2023): We were just discussing similar issues in #2009. Are you suggesting this might be a regression in the 0.23.0 release? This is an error from the idna crate. I'm not exactly sure where/why that is being called here. Unfortunately I won't have much time to investigate, but I'm happy to support you if you have a chance to dig in. I do agree that it would probably make sense that `TxtLookup` should allow you to iterate over records independently of whether a specific record doesn't validate. Would you be able to send a PR for that?
Author
Owner

@bluejekyll commented on GitHub (Sep 6, 2023):

I wonder if we need to stop relying on the idna crate. It was an easy way to get a puny code implementation, but it might not have enough flexibility for us?

<!-- gh-comment-id:1708638149 --> @bluejekyll commented on GitHub (Sep 6, 2023): I wonder if we need to stop relying on the `idna` crate. It was an easy way to get a puny code implementation, but it might not have enough flexibility for us?
Author
Owner

@djc commented on GitHub (Sep 7, 2023):

From my experience working with the idna crate it is pretty flexible and very optimized, I don't think it's at fault here.

<!-- gh-comment-id:1709681724 --> @djc commented on GitHub (Sep 7, 2023): From my experience working with the idna crate it is pretty flexible and very optimized, I don't think it's at fault here.
Author
Owner

@delta4chat commented on GitHub (Aug 2, 2024):

The error still occurs for parsing a dns message with domain foo_bar.com, so sometimes this causes actual problems, such as when querying the SPF of some domain: dig spf_a0.gsa.gov -t TXT @127.0.0.1 -p 1053

But parse that DNS query returns this error:

cannot convert to hickory Query: Label contains invalid characters: Err(Errors { invalid_mapping, disallowed_by_std3_ascii_rules })
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

In other resolvers (such as 8.8.8.8) query this should returns some TXT record with IP ranges.

dig spf_a0.gsa.gov -t TXT @8.8.8.8
;; ->>HEADER<<- opcode: QUERY; status: NOERROR; id: 51685
;; Flags: qr rd ra; QUERY: 1; ANSWER: 1; AUTHORITY: 0; ADDITIONAL: 0

;; QUESTION SECTION:
;; spf_a0.gsa.gov.              IN      TXT

;; ANSWER SECTION:
spf_a0.gsa.gov.         10800   IN      TXT     "v=spf1 ip4:159.142.1.236 ip4:159.142.38.196/30 ip4:159.142.160.13 ip4:159.142.166.247 ip4:159.142.1.214/31 ip4:159.142.1.216 ip4:159.142.1.218/31 ip4:159.142.72.63/30 ip4:159.142.72.68 ip4:159.142.191.80 ip4:159.142.134.75 ~all"

;; Received 272 B
<!-- gh-comment-id:2264573792 --> @delta4chat commented on GitHub (Aug 2, 2024): The error still occurs for parsing a dns message with domain `foo_bar.com`, so sometimes this causes actual problems, such as when querying the SPF of some domain: `dig spf_a0.gsa.gov -t TXT @127.0.0.1 -p 1053` But parse that DNS query returns this error: ``` cannot convert to hickory Query: Label contains invalid characters: Err(Errors { invalid_mapping, disallowed_by_std3_ascii_rules }) note: run with RUST_BACKTRACE=1 environment variable to display a backtrace ``` In other resolvers (such as 8.8.8.8) query this should returns some TXT record with IP ranges. ``` dig spf_a0.gsa.gov -t TXT @8.8.8.8 ;; ->>HEADER<<- opcode: QUERY; status: NOERROR; id: 51685 ;; Flags: qr rd ra; QUERY: 1; ANSWER: 1; AUTHORITY: 0; ADDITIONAL: 0 ;; QUESTION SECTION: ;; spf_a0.gsa.gov. IN TXT ;; ANSWER SECTION: spf_a0.gsa.gov. 10800 IN TXT "v=spf1 ip4:159.142.1.236 ip4:159.142.38.196/30 ip4:159.142.160.13 ip4:159.142.166.247 ip4:159.142.1.214/31 ip4:159.142.1.216 ip4:159.142.1.218/31 ip4:159.142.72.63/30 ip4:159.142.72.68 ip4:159.142.191.80 ip4:159.142.134.75 ~all" ;; Received 272 B ```
Author
Owner

@delta4chat commented on GitHub (Aug 2, 2024):

Is there any way or option to bypass this error so that DNS query packets "containing underscores in domains" can be correctly parsed?

This seems to have solved my problem: https://docs.rs/hickory-proto/0.24.1/hickory_proto/rr/domain/struct.Name.html#method.from_str_relaxed

<!-- gh-comment-id:2264573848 --> @delta4chat commented on GitHub (Aug 2, 2024): <del> Is there any way or option to bypass this error so that DNS query packets "containing underscores in domains" can be correctly parsed? </del> This seems to have solved my problem: https://docs.rs/hickory-proto/0.24.1/hickory_proto/rr/domain/struct.Name.html#method.from_str_relaxed
Author
Owner

@bluejekyll commented on GitHub (Aug 11, 2024):

Given the workaround above, I'm going to close this.

<!-- gh-comment-id:2282370873 --> @bluejekyll commented on GitHub (Aug 11, 2024): Given the workaround above, I'm going to close this.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#848
No description provided.