Repository navigation
fix(http): read the OS trust store on the tls-rustls backend (odbc#323) - #316
Conversation
There was a problem hiding this comment.
Verdict: 1 Low
Looks good — a clean, well-justified additive TLS change. The tls-rustls feature correctly gains rustls-tls-native-roots, the updated debug comment is accurate, and the new hermetic test's API usage matches the public surface; all new transitive crates are under already-allow-listed licenses so no deny.toml change is needed. One low-severity nit: pyo3/Cargo.lock wasn't regenerated even though pyo3 also builds on tls-rustls.
| # fallback lost). This gives the aarch64 cross-build — the only Linux arch on | ||
| # `tls-rustls` — system-CA parity with the x86_64/i686 OpenSSL builds. See | ||
| # odbc#323. | ||
| tls-rustls = ["reqwest/rustls-tls", "reqwest/rustls-tls-native-roots"] |
There was a problem hiding this comment.
🔵 Low — The tls-rustls feature now pulls in rustls-native-certs (and openssl-probe, schannel, security-framework, core-foundation). The root Cargo.lock and napi/Cargo.lock were regenerated to include these, but pyo3/Cargo.lock — which also resolves the kernel with features = ["tls-rustls"] (pyo3/Cargo.toml:75) — was not: it still has no rustls-native-certs entry. This isn't a CI failure (pyo3-checks runs cargo test without --locked, so cargo silently regenerates the lockfile at build time), but it leaves the committed pyo3 lockfile drifted from the feature change and inconsistent with the other two lockfiles the PR did update. Regenerate it (cd pyo3 && cargo update -p reqwest --precise <same> or a plain cargo build then commit the lockfile) so the pinned dependency graph reflects the new trust-store crates.
## Summary The `tls-rustls` kernel backend validated server certificates against Mozilla's bundled `webpki-roots` **only**, ignoring the OS system trust store that the default `tls-native` (OpenSSL) backend reads. A server whose chain terminates in a **private/internal CA installed only in the system store** (`/etc/ssl/...`) therefore failed the TLS handshake under `tls-rustls` while succeeding under `tls-native`. This surfaces as a Linux **aarch64**-specific support case for the ODBC driver: aarch64 is the only Linux arch cross-built onto `tls-rustls` (to avoid a cross OpenSSL), so its packages diverged from the x86_64 / i686 OpenSSL builds behind a corporate MITM proxy or an internal PKI. See databricks/databricks-odbc#323. ## What changed `tls-rustls` now enables `reqwest/rustls-tls-native-roots` alongside `reqwest/rustls-tls`. reqwest defaults both `tls_built_in_certs_webpki` and `tls_built_in_certs_native` to `true` when their features are on, so it loads the OS trust store (via `rustls-native-certs`) **and** the Mozilla bundled roots into one `RootCertStore`. The change is strictly additive — the webpki fallback is retained — and applies equally to the napi / pyo3 bindings, which also build on `tls-rustls`. `rustls-native-certs` is pure Rust (it reads `/etc/ssl/...` / honours `SSL_CERT_FILE`), so the aarch64 cross-build needs no cross C OpenSSL. ## Test plan - New hermetic integration test `tests/tls_rustls_native_roots.rs` (gated on `tls-rustls`): generates a private CA + server cert at runtime, serves HTTPS from it, exposes the CA as the OS trust store via `SSL_CERT_FILE`, and drives the kernel's default HTTP client (no custom CA, no `allow_self_signed`). Fails with the old webpki-roots-only wiring (unknown issuer), passes with the fix. - `cargo test --no-default-features --features tls-rustls`: 916 pass; the sole failure (`mtls_identity_is_forwarded_when_session_opens`) is pre-existing on `origin/main` under `tls-rustls` and unrelated to this change (mTLS identity-parse error ordering, not trust store). - `cargo clippy` + `cargo fmt --check` clean on both backends; napi binding builds with the changed feature. Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
ca170ff to
a4ed9d7
Compare
Summary
The
tls-rustlskernel backend validated server certificates against Mozilla's bundledwebpki-rootsonly, ignoring the OS system trust store that the defaulttls-native(OpenSSL) backend reads. A server whose chain terminates in a private/internal CA installed only in the system store (/etc/ssl/...) therefore failed the TLS handshake undertls-rustlswhile succeeding undertls-native.This surfaced as a Linux aarch64-specific support case for the ODBC driver: aarch64 is the only Linux arch cross-built onto
tls-rustls(to avoid a cross OpenSSL), so its packages diverged from the x86_64 / i686 OpenSSL builds behind a corporate MITM proxy or an internal PKI. See databricks/databricks-odbc#323.What changed
tls-rustlsnow enablesreqwest/rustls-tls-native-rootsalongsidereqwest/rustls-tls. reqwest defaults bothtls_built_in_certs_webpkiandtls_built_in_certs_nativetotruewhen their features are on, so it loads the OS trust store (viarustls-native-certs) and the Mozilla bundled roots into oneRootCertStore. The change is strictly additive — the webpki fallback is retained — and applies equally to the napi / pyo3 bindings, which also build ontls-rustls.rustls-native-certsis pure Rust (it reads/etc/ssl/.../ honoursSSL_CERT_FILE), so the aarch64 cross-build needs no cross C OpenSSL — the whole reasontls-rustlswas selected there.Test plan
tests/tls_rustls_native_roots.rs(gated ontls-rustls): generates a private CA + server cert at runtime, serves HTTPS from it, exposes the CA as the OS trust store viaSSL_CERT_FILE, and drives the kernel's default HTTP client (no custom CA, noallow_self_signed). Fails with the old webpki-roots-only wiring (unknown issuer), passes with the fix.cargo test --no-default-features --features tls-rustls: 916 pass; the sole failure (mtls_identity_is_forwarded_when_session_opens) is pre-existing onorigin/mainundertls-rustlsand unrelated to this change (mTLS identity-parse error ordering, not trust store).cargo clippy+cargo fmt --checkclean on both backends; the napi binding builds with the changed feature.Downstream
Once merged, databricks-odbc bumps
KERNEL_REPO_TAGto this commit to give its aarch64 package system-CA parity with x86_64/i686 — no ODBC packaging change needed.