Skip to content

Commit 8ff501b

Browse files
lfranckeclaude
andcommitted
chore(deps): drop unmaintained rustls-pemfile; allow LLVM-exception
cargo-deny flagged three issues against the current advisory DB. The cargo update commit already resolves the postgres-protocol (>=0.6.12) and tokio-postgres (RUSTSEC-2026-0178, >=0.7.18) advisories. This commit handles the remaining two: - rustls-pemfile is unmaintained (RUSTSEC-2025-0134) with no safe upgrade. It is now a thin wrapper around rustls-pki-types, which we already depend on. Migrate src/tls.rs to the rustls-pki-types PemObject API (CertificateDer::pem_file_iter / PrivateKeyDer::from_pem_file, behind the `std` feature) and drop the rustls-pemfile dependency. - Allow "Apache-2.0 WITH LLVM-exception" in deny.toml. It is pulled in via psm/stacker (sqlparser's recursion guard) and is Apache-2.0-compatible. cargo deny check now reports advisories/bans/licenses/sources all ok; build, clippy -D warnings, fmt, and the full test suite (incl. the TLS keypair tests, against Trino 479) pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 0523e54 commit 8ff501b

4 files changed

Lines changed: 14 additions & 26 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ serde_json = "1"
2222
trino-rust-client = "0.9"
2323
async-stream = "0.3"
2424
sqlparser = { version = "0.61", features = ["visitor"] }
25-
rustls-pemfile = "2"
26-
rustls-pki-types = "1"
25+
# PEM parsing uses rustls-pki-types' PemObject API directly (the `std`
26+
# feature provides the file-reading methods). rustls-pemfile was dropped —
27+
# it is unmaintained (RUSTSEC-2025-0134) and is now just a thin wrapper
28+
# around this same code.
29+
rustls-pki-types = { version = "1", features = ["std"] }
2730
rand = "0.10"
2831

2932
[build-dependencies]

deny.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ unused-allowed-license = "allow"
2525
confidence-threshold = 1.0
2626
allow = [
2727
"Apache-2.0",
28+
# Apache-2.0 with the permissive LLVM compiler exception; pulled in via
29+
# psm/stacker (sqlparser's recursion guard). Apache-2.0-compatible.
30+
"Apache-2.0 WITH LLVM-exception",
2831
"BSD-2-Clause",
2932
"BSD-3-Clause",
3033
"CC0-1.0",

src/tls.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@
2121
//! provider has been installed and removes the ordering coupling between
2222
//! `build_acceptor` and any global init step.
2323
24-
use std::fs::File;
25-
use std::io::BufReader;
2624
use std::path::Path;
2725
use std::sync::Arc;
2826

2927
use anyhow::{Context, Result, anyhow};
3028
use pgwire::tokio::TlsAcceptor;
3129
use pgwire::tokio::tokio_rustls::rustls::ServerConfig;
3230
use pgwire::tokio::tokio_rustls::rustls::crypto::aws_lc_rs;
31+
use rustls_pki_types::pem::PemObject;
3332
use rustls_pki_types::{CertificateDer, PrivateKeyDer};
3433

3534
/// Build a `TlsAcceptor` from PEM-encoded certificate chain and private key
@@ -56,11 +55,9 @@ pub fn build_acceptor(cert_path: &Path, key_path: &Path) -> Result<TlsAcceptor>
5655
}
5756

5857
fn load_certs(path: &Path) -> Result<Vec<CertificateDer<'static>>> {
59-
let file = File::open(path)
60-
.with_context(|| format!("opening TLS certificate file {}", path.display()))?;
61-
let mut reader = BufReader::new(file);
62-
let certs: Vec<CertificateDer<'static>> = rustls_pemfile::certs(&mut reader)
63-
.collect::<std::io::Result<Vec<_>>>()
58+
let certs: Vec<CertificateDer<'static>> = CertificateDer::pem_file_iter(path)
59+
.with_context(|| format!("opening TLS certificate file {}", path.display()))?
60+
.collect::<Result<Vec<_>, _>>()
6461
.with_context(|| format!("reading TLS certificate PEM {}", path.display()))?;
6562
if certs.is_empty() {
6663
return Err(anyhow!("no PEM certificates found in {}", path.display()));
@@ -69,13 +66,8 @@ fn load_certs(path: &Path) -> Result<Vec<CertificateDer<'static>>> {
6966
}
7067

7168
fn load_key(path: &Path) -> Result<PrivateKeyDer<'static>> {
72-
let file =
73-
File::open(path).with_context(|| format!("opening TLS key file {}", path.display()))?;
74-
let mut reader = BufReader::new(file);
75-
let key = rustls_pemfile::private_key(&mut reader)
76-
.with_context(|| format!("reading TLS key PEM {}", path.display()))?
77-
.ok_or_else(|| anyhow!("no PEM private key found in {}", path.display()))?;
78-
Ok(key)
69+
PrivateKeyDer::from_pem_file(path)
70+
.with_context(|| format!("reading TLS private key PEM {}", path.display()))
7971
}
8072

8173
#[cfg(test)]

0 commit comments

Comments
 (0)