feat(tls): server certificate SAN can have a trailing dot - #1405
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
| webpki_verifier: Arc<dyn ServerCertVerifier>, | ||
| } | ||
|
|
||
| impl TrailingDotVerifier { |
There was a problem hiding this comment.
I'm not familiar with the rustls API but this seems like a lot of code for a trailing dot. (And it wouldn't surprise me at all that the TLS library API actually makes it this hard)
There was a problem hiding this comment.
Yeah... I'm not sure if this is how this is supposed to be done. I'm waiting for a review from Ryan.
|
It looks like curl strips trailing dots automatically, but the default in go Here is the python GCP cloud sql issue: It looks like the GCP Go connector does the same thing this PR does, so that's a good sign: https://github.com/GoogleCloudPlatform/cloud-sql-go-connector/blob/main/internal/cloudsql/tls_verify.go#L112-L118 I guess I could see not wanting to fall back to custom code for strict verification, so if that's a concern I suppose it could be a configuration option to strip the dot? |
| if matches!( | ||
| &result, | ||
| Err(rustls::Error::InvalidCertificate( | ||
| rustls::CertificateError::NotValidForNameContext { .. } |
There was a problem hiding this comment.
Would this make sense as
Err(rustls::Error::InvalidCertificate(
rustls::CertificateError::NotValidForName
| rustls::CertificateError::NotValidForNameContext { .. },
))
It sounds like rustls considers it okay to change enum variants, so this might help avoid a silent behavior change if I'm reading this right.
No description provided.