Repository navigation
Commit 9ecd357
fix(http): read the OS trust store on the tls-rustls backend (odbc#323) (#316)
## 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 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-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 —
the whole reason `tls-rustls` was selected there.
## 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; the
**napi** binding builds with the changed feature.
## Downstream
Once merged, databricks-odbc bumps `KERNEL_REPO_TAG` to this commit to
give its aarch64 package system-CA parity with x86_64/i686 — no ODBC
packaging change needed.
Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>1 parent df2768b commit 9ecd357
6 files changed
Lines changed: 383 additions & 4 deletions
File tree
- napi
- pyo3
- src/client
- tests
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
196 | 206 | | |
197 | 207 | | |
198 | 208 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
479 | 479 | | |
480 | 480 | | |
481 | 481 | | |
482 | | - | |
483 | | - | |
484 | | - | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
485 | 487 | | |
486 | 488 | | |
487 | 489 | | |
| |||
0 commit comments