Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using a verbatim common name including a trailing dot when establishing a TLS connection causes certificate issues #2247

Open
udoprog opened this issue Apr 14, 2024 · 0 comments

Comments

@udoprog
Copy link

udoprog commented Apr 14, 2024

When using a fully qualified domain name like google.com. (note the trailing dot), reqwest uses the provided domain in verbatim when comparing the common name of the certificate (CN).

For example, this:

let text = reqwest::get("https://google.com.").await.unwrap().text().await.unwrap();

Errors like this on my machine using native-tls:

reqwest::Error { kind: Request, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("google.com.")), port: None, path: "/", query: None, fragment: None }, 
source: Error { kind: Connect, source: Some(Os { code: -2146762481, kind: Uncategorized, message: "The certificate's CN name does not match the passed value." }) } }

A trailing dot should be semantically equivalent in DNS, but hardly anybody issues certificates with a CN including them. It might be appropriate to do like most browsers and filter such domains by ignoring the trailing dot when doing the CN comparison.

This seems to be the behavior of requests.

>>> import requests
>>> requests.get("https://google.com.") 
<Response [200]>

It might also be interesting to read Mozzila's position on the matter.

@udoprog udoprog changed the title reqwest using a verbatim CN when establishing a TLS connection when filtering might be appropriate Using a verbatim common name including a trailing dot when establishing a TLS connection causes certificate issues Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant