feat(postgresql)/issue 209 verify ca and verify full#211
Conversation
|
Thanks for tackling #209! I'm not a maintainer — just a user who read through the diff out of interest. Sharing a few observations below in case they're useful to you or the maintainers. Take or leave any of these. Things that stood out1.
|
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Resolved Issues (2)
Files Reviewed (1 file)
Reviewed by kimi-k2.6 · 146,779 tokens |
Co-authored-by: kilo-code-bot[bot] <240665456+kilo-code-bot[bot]@users.noreply.github.com>
Co-authored-by: kilo-code-bot[bot] <240665456+kilo-code-bot[bot]@users.noreply.github.com>
|
@ymadd Thank you again for the extremely thorough review – it was incredibly helpful. What has been fixed (matching your feedback)
One minor issue I noticed while reviewing the codeIn let mut cursor = std::io::Cursor::new(&pem[..]);
for cert in rustls_pemfile::certs(&mut cursor) {
let cert = cert.map_err(...)?;
...
}However, let cert_iter = rustls_pemfile::certs(&mut cursor)
.map_err(|e| format!("Failed to parse ssl_ca '{}': {}", path, e))?;
for cert in cert_iter {
let cert = cert.map_err(|e| format!("..."))?;
roots.add(cert).map_err(|e| format!("..."))?;
}I believe this is just a copy‑paste oversight in the snippet you shared – the actual code in your repository may already be correct. Could you double‑check it? Apart from that, everything else looks solid. Final noteYour review was exceptionally detailed and saved us from several subtle pitfalls. Thank you again for taking the time to write it up. If you spot anything else, please don’t hesitate to point it out – I’ll be happy to follow up. Best regards |
|
@VincentZhangy Thanks for the thorough revisions! All the Critical items look cleanly addressed, and the rewrite of |
|
Looks a very good work! |
|
Hi @VincentZhangy, Thanks for the detailed write-up — the changes look good to me, everything you listed lines up with the diff. About the pub fn certs<R: BufRead>(rd: &mut R)
-> impl Iterator<Item = Result<CertificateDer<'static>, io::Error>>So each item yielded by the loop is already a @ymadd could you confirm this on your side as well? If we're aligned, I'd say no further changes are needed and we can move toward merging. By the way, if you'd like to chat with the maintainers or get more involved with the project, feel free to join our Discord: https://discord.com/invite/K2hmhfHRSt — would be great to have you there. |
|
Confirmed on my side as well — the current code is correct. I checked the local rustls-pemfile 2.2.0 source and the signature is: pub fn certs(rd: &mut dyn io::BufRead)
-> impl Iterator<Item = Result<CertificateDer<'static>, io::Error>>So the iterator is returned directly and each item is a No further changes needed from my side — this looks good to merge. |
Extend the SSL mode support in libpq to include 'verify-ca' and 'verify-full',
bringing it in line with PostgreSQL's libpq behavior.
Fix issues in the existing SSL implementation where only 'require' mode was
properly handled. Refactor the SSL context configuration to correctly set
certificate verification flags and hostname validation callbacks.
Optimize the certificate verification logic by:
This change ensures secure TLS connections with proper certificate checks,
preventing man-in-the-middle attacks when using the stricter SSL modes.
close #209