Skip to content

feat(tls): opt-in certificate revocation checking - #485

Open
cathleeny wants to merge 44 commits into
mainfrom
cathleeny/feat/tls-certificate-revocation
Open

cathleeny wants to merge 44 commits into
mainfrom
cathleeny/feat/tls-certificate-revocation

Conversation

@cathleeny

@cathleeny cathleeny commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds opt-in TLS certificate revocation checking, on Windows with the tls-rustls backend only, using Windows CryptoAPI. It is off by default. The only consumer is the OSS ODBC driver on Windows (databricks-odbc#515), as with Simba.

How it works

  • Trust stays with webpki. It verifies the chain, hostname and signatures as before. Only after that does CryptoAPI check revocation (CRL and OCSP) for every certificate on the chain except the root.
  • Revoked certificates are rejected in both modes.
  • Invalid signatures on any chain element count as undetermined, never good.
  • Stapled OCSP: a response the server staples is handed to CryptoAPI for the leaf, so it can skip a fetch. rustls requests stapling by default. Empty or invalid responses are ignored.
  • Undetermined (status unknown, revocation server offline, or a chain Windows can't finish) is rejected in strict mode and accepted with accept-undetermined. These are Simba's semantics.
  • Custom CAs: if Windows can't decide because the root isn't in its store, the chain is checked again with a CryptoAPI chain engine that trusts the configured CAs. Both checks share one time limit.
  • Network and timing:
    • Revocation downloads use Windows networking and proxy settings, and Windows caches the results.
    • The revocation time limit is about 10 s in total.
    • The check runs synchronously, so it can delay a caller's timeout by up to that limit.
  • Other rules:
    • Session resumption is disabled while checking is on.
    • Trust anchors aren't revocation-checked.
    • On other platforms or backends, asking for revocation fails session open with InvalidArgument.

API

  • Config: TlsConfig.check_certificate_revocation and accept_undetermined_certificate_revocation.
  • C ABI: kernel_session_config_set_tls_certificate_revocation.
  • pyo3 and napi don't expose it.

Testing

  • Linux: fmt, clippy, unit tests and the C ABI smoke test pass. The one test failure also happens on main.
  • Windows (new windows-revocation CI job):
    • good, revoked and unreachable-CRL chains, each in both modes;
    • custom CAs, configured as the root and as an intermediate;
    • a strict session opened through the C ABI;
    • session resumption off;
    • a multi-threaded runtime.
  • Live (Linux): with revocation off, connections pass. With revocation on, session open fails with InvalidArgument, as intended.

CI note

The license and security checks fail on RUSTSEC-2026-0543: chrono is unmaintained. chrono is already in main's lockfile and this failure hits every kernel PR, so a kernel owner needs to decide.

Related PRs: https://github.com/databricks/databricks-odbc/pull/515, databricks/databricks-jdbc#1825, https://github.com/databricks/databricks-driver-test/pull/2190

This pull request and its description were written by Isaac.

Add an opt-in TLS certificate-revocation policy. It is off by default, so
existing connections are unchanged.

- Public TlsConfig gains check_certificate_revocation and
  accept_undetermined_certificate_revocation (Option<bool>; unset means off).
  Session open rejects a revocation request on tls-native with InvalidArgument.
- tls-rustls: with checking on, the verifier builds the chain with webpki,
  then fetches the CRLs from each certificate's distribution points (end-entity
  and intermediates) and checks them with webpki. Revoked is rejected in both
  modes. An undetermined status is rejected in strict mode and accepted in
  accept-undetermined mode. A bad CRL signature or wrong issuer is rejected in
  both modes. A rejected CRL is evicted from the cache.
- CRL fetches send no auth or custom headers, go through the connection's
  proxy, and are bounded by a 10 s timeout, a 32 MiB body and 3 redirects. Each
  CRL is cached until its nextUpdate.
- accept_self_signed turns revocation off.
- C ABI: kernel_session_config_set_tls_certificate_revocation, with a smoke
  check in tests/c/session_smoke.c.
- Hermetic tests use an rcgen PKI, a loopback CRL server, a loopback TLS server
  and a loopback forward-proxy stub. One table covers each outcome in both modes.
- tests/tls_revocation_e2e.rs is an #[ignore] live hook driven by
  DATABRICKS_TEST_REVOCATION=off|strict|accept_undetermined.

Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>
Co-authored-by: Isaac <no-reply@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Terra), checked by a judge model (Claude Sonnet 5.5).

Verdict: 4 High · 4 Low · 2 Nit

Solid, well-tested feature — 1 medium concern. Synchronous CRL fetches can block a handshake (and a tokio worker) for a long time with no overall time limit; the other findings are lower-priority clean-ups.

This overview is Claude Opus 5.5's initial take; GPT-6.1 Terra added findings it doesn't mention — see the findings below.

Other findings

  • ⚪ Nit — The hand-written Debug impls for both TlsConfig types omit the new revocation fields, so logs don't show whether revocation is on. Add the two non-secret fields to both impls. (Found by Claude Opus 5.5 · confirmed by the judge)
  • ⚪ Nit — Each uncached CRL fetch spawns a thread, builds a runtime and builds a new reqwest Client. The cost is bounded because current CRLs are cached. Build the proxied client once and reuse it. (Found by Claude Opus 5.5 · confirmed by the judge)

Comment thread src/client/tls_revocation.rs Resolved
Comment thread src/client/http.rs Resolved
Comment thread src/client/tls_revocation.rs Resolved
Comment thread src/client/tls_revocation.rs Resolved
Comment thread src/client/tls_revocation.rs Resolved
Comment thread src/client/tls_revocation.rs Resolved
Comment thread src/client/http.rs Resolved
Comment thread src/config.rs Resolved
cathleeny and others added 2 commits November 19, 2026 18:51
Expose the opt-in revocation policy to the Python and Node bindings. Both
default to off, so existing connections are unchanged.

- pyo3 Session: tls_check_certificate_revocation and
  tls_accept_undetermined_revocation (Optional[bool], default None).
- napi ConnectionOptions: checkCertificateRevocation and
  acceptUndeterminedRevocation (boolean, optional).

Both map onto TlsConfig.check_certificate_revocation and
accept_undetermined_certificate_revocation. The napi index.d.ts is updated.
The lockfiles gain the kernel's rustls-native-certs and der edges.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>
Verifier:
- Only certificates on a path webpki verifies are checked. The presented
  intermediates are tried smallest subset first, so a certificate the server
  appends that no path needs is never fetched. More than six presented
  intermediates is rejected.
- A certificate is a trust anchor only when its subject and SPKI match a
  configured root, not when its issuer and subject names match.
- One deadline bounds all CRL fetches for a chain, at the per-fetch timeout.
- CRL fetches trust the connection's custom CA roots, as the connection does.
- Fetch failures are logged at debug level with the URL (userinfo removed) and
  the reason.

Configuration:
- The internal TlsConfig is #[non_exhaustive], like the public one, so the
  pub(crate) CRL limits field no longer affects external struct construction.
- On tls-native, a revocation request with accept_self_signed is accepted,
  since self-signed acceptance turns revocation off. The Debug output includes
  the revocation fields.

Tests: an unrelated appended certificate is never fetched; a same-name
certificate with another key is not a trust anchor; one timeout budget bounds
all fetches for a chain.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>
The unquoted run value ended in client::, which YAML reads as a mapping value. GitHub rejected pr-checks.yml at 04c85c4, so none of its jobs ran. The command is now quoted, as the Linux step is.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Terra), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 High · 1 Medium · 2 Low

Looks good overall, with 1 medium and 1 low concern. The CryptoAPI design is sound: webpki verifies first, revocation is checked afterwards, resumption is disabled, and it is rejected cleanly on unsupported platforms. The gaps are a C ABI test that can never compile and a misplaced doc comment.

This overview is Claude Opus 5.5's initial take; GPT-6.1 Terra added findings it doesn't mention — see the findings below.

Comment thread src/c_abi/session.rs Resolved
Comment thread src/client/http.rs Resolved
Comment thread src/client/http.rs Resolved
Comment thread src/client/tls_revocation.rs Resolved

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Terra), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 High · 2 Medium · 1 Low · 1 Nit

The design is solid, with 2 medium concerns. A Windows C-ABI test for the revoked path is gated so it never compiles. The custom-CA retry can double the documented 10 s revocation wait.

This overview is Claude Opus 5.5's initial take; GPT-6.1 Terra added findings it doesn't mention — see the findings below.

Other findings

  • ⚪ Nit — The new revocation() was inserted under the existing doc line for inner(), so that line now documents the wrong function and inner() has no doc. Move the doc line back onto inner(). (Found by Claude Opus 5.5 · confirmed by the judge)

Comment thread src/telemetry/runtime.rs Resolved
Comment thread src/c_abi/session.rs Resolved
Comment thread src/client/tls_revocation.rs Resolved
Comment thread src/client/http.rs Resolved
cathleeny and others added 3 commits November 20, 2026 18:35
allow_self_signed turns revocation off. The client now stores that effective mode, not the requested one, so the telemetry cache key matches what the client does. A unit test covers a self-signed session with revocation requested. The revocation() accessor has its own doc, and inner() keeps its original doc.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>
The strict open test sat in a module compiled only where Windows and tls-rustls are not both on, so it never ran. It now has its own module gated on Windows with tls-rustls. The Windows spike type-checks it.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>
With custom CAs, an undetermined default-engine result is built again with the exclusive-root engine. Before, that second build got a fresh 10 s, so one handshake could wait about 20 s. The second build now gets only the time the first left, and is skipped when none is left. The default engine still builds first, so a public chain that verifies costs one build. The docs state the shared budget and the engine order.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Terra), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 High · 1 Medium · 2 Low

Looks good: 1 medium and 1 low concern, both about Windows test coverage in CI. The CryptoAPI resource guards, how the revocation status is read, the second-build time budget and the telemetry cache key all look correct.

This overview is Claude Opus 5.5's initial take; GPT-6.1 Terra added findings it doesn't mention — see the findings below.

Other findings

  • 🟠 High — Disputed by the cross-check judge (it quotes CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT | CERT_CHAIN_REVOCATION_ACCUMULATIVE_TIMEOUT;); a human should decide. Original finding: A self-signed server certificate produces a one-element chain, so excluding the root also excludes the leaf and can report a revoked or unchecked certificate as good. Check the leaf explicitly when it is also the chain root, and test strict and accept-undetermined modes with a self-signed server certificate. (Found by GPT-6.1 Terra · disputed by the judge)

Comment thread src/client/tls_revocation_tests.rs Resolved
Comment thread src/client/tls_revocation.rs Resolved
Comment thread .github/workflows/pr-checks.yml Resolved
@cathleeny

Copy link
Copy Markdown
Collaborator Author

On the disputed High in this review (a self-signed server certificate gives a one-element chain, so CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT also skips the leaf): this is by design, not a gap. A self-signed server certificate can only pass this verifier if it is itself a configured trust anchor. webpki decides trust first, and it accepts a self-signed leaf only when that exact certificate is in the roots, for example as a custom CA. A trust anchor is trusted by configuration, so revocation checking doesn't apply to it:

  • RFC 5280 path validation checks revocation for the certificates on the path, not for the trust anchor;
  • Java's PKIX revocation checker (JDBC) and webpki's CRL support don't check the anchor either;
  • CryptoAPI's EXCLUDE_ROOT, which Simba uses, is the same rule.

To stop trusting such a certificate, remove it from the configured CAs. That is the standard way. Separately, allow_self_signed (the setting that accepts untrusted self-signed servers) turns revocation off entirely, as documented, so that mode never claims a revocation check. I'm adding a line to the docs saying that trust anchors, including a self-signed server certificate configured as a custom CA, aren't revocation-checked. No behavior change.

Automated reply from the driver feature factory (Isaac). Not reviewed by a human.

cathleeny and others added 4 commits November 20, 2026 18:59
The exclusive-root engine set no dwExclusiveFlags, so a non-self-signed custom CA, such as a configured intermediate, may not have been treated as a root. The chain then stayed partial and was undetermined. The engine now sets CERT_CHAIN_EXCLUSIVE_ENABLE_CA_FLAG. cbSize is the size of the full struct, so the field is covered.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>
…ntime

A custom CA configured as the intermediate anchors the chain: a good chain passes in strict mode, and a revoked leaf is rejected. A multi-thread runtime test takes the block_in_place branch that the current_thread tests never reach. These tests run on Windows only, where the module is compiled.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>
A trust anchor is not revocation-checked, including a self-signed server certificate configured as a custom CA. That matches RFC 5280, the JDK PKIX path validator and CryptoAPI's exclude-root flag. The leaf and the other chain certificates are checked.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>
The Windows client:: filter does not match c_abi::session, so the strict C ABI open test never ran in CI. The step now runs client:: and then the revocation open test in a second cargo test invocation. Two invocations avoid relying on libtest's multiple-filter support.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Terra), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 High · 1 Nit

Looks good, with 2 low concerns. The CryptoAPI verifier frees every handle it opens through RAII guards, rejects revocation requests up front with InvalidArgument where it isn't supported, and has Windows tests covering the strict and accept-undetermined outcomes.

This overview is Claude Opus 5.5's initial take; GPT-6.1 Terra added findings it doesn't mention — see the findings below.

Other findings

  • 🟠 High — Disputed by the cross-check judge (it quotes let cache_key = telemetry_cache_key(&connection.host, http_client.revocation());); a human should decide. Original finding: Sessions with the same host and revocation mode still share the first session's authenticated HTTP client, even when their credentials or custom CA sets differ, so telemetry can be sent under another identity or checked against the wrong revocation chain. Isolate telemetry clients per session or include all authentication and TLS inputs in the cache key, and test the real exporter with distinct sessions. (Found by GPT-6.1 Terra · disputed by the judge)
  • ⚪ Nit — Each build_reqwest_client call with revocation on rebuilds the rustls ClientConfig. That reloads the OS root store and rereads the CA file. first_redirect_location is the only repeat caller, and it is a rare Azure discovery path, so the cost is minor. Cache the Arc in the client. (Found by Claude Opus 5.5 · confirmed by the judge)

The first Windows run of tls_revocation_strict_open_rejects_a_revoked_leaf
showed the revocation working: the exclusive-root engine reported REVOKED,
and session open returned NetworkError. The test only failed its last
assertion, because rustls renders the error as "invalid peer certificate:
Revoked" and the test looked for lowercase "revoked". Compare
case-insensitively.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>
@cathleeny

Copy link
Copy Markdown
Collaborator Author

Dispositions for the review of 3f4ff95. Neither needs a change:

  • High, disputed by the judge (telemetry clients shared across sessions with the same host and revocation mode but different credentials or custom CAs): this predates the PR and is out of its scope. Before this PR, the telemetry client cache was keyed by host alone, so every session on a host already shared one client whatever its credentials or TLS settings. This PR narrows that by adding the effective revocation mode to the key, so a revocation-on session never reuses a client built with revocation off. Isolating telemetry clients per session, or keying on all auth and TLS inputs, is a telemetry design change for a separate PR.
  • Nit (cache the rustls ClientConfig instead of rebuilding it per build_reqwest_client call): same disposition as the earlier "OS roots reload" threads. The rebuild costs the same as with revocation off, since reqwest also loads the OS roots per build, and the only repeat caller is the redirect probe, once per Azure tenant discovery.

The Windows job on 3f4ff95 confirmed the custom-root fix. For a CRL-revoked leaf under a custom CA, the default engine reported UNTRUSTED_ROOT, REVOCATION_STATUS_UNKNOWN, and the exclusive-root engine reported REVOKED. All 162 client:: tests passed. The one failure was the new C ABI test's message check, which looked for lowercase "revoked" while rustls renders "Revoked". Fixed in 6b56287.

Automated reply from the driver feature factory (Isaac). Not reviewed by a human.

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Terra), checked by a judge model (Claude Sonnet 5.5).

Verdict: 2 High · 1 Nit

Looks good — 1 low concern. The CryptoAPI resource guards, the shared budget between the two chain builds, disabling resumption, and the InvalidArgument path on unsupported platforms all look correct, and tests cover them. Nit: the C ABI setter called with check=false still sets Some(false), which forces an explicit TlsConfig build. This is harmless.

This overview is Claude Opus 5.5's initial take; GPT-6.1 Terra added findings it doesn't mention — see the findings below.

Other findings

  • 🟠 High — A CryptoAPI chain with an invalid certificate signature can be classified as good because its signature-error bit is ignored, even though webpki may have verified a different chain. Treat a chain whose signatures are invalid as undetermined and test an alternate-issuer chain. (Found by GPT-6.1 Terra · the judge couldn't confirm it)
  • ⚪ Nit — The Windows scenario table covers CRL distribution points only, so OCSP paths, which the docs advertise, are untested. Add an OCSP-only fixture and assert both modes. (Found by GPT-6.1 Terra · confirmed by the judge)

Comment thread src/telemetry/runtime.rs Resolved
Comment thread src/client/tls_revocation.rs Resolved
Comment thread src/telemetry/runtime.rs Resolved
cathleeny and others added 3 commits November 20, 2026 21:28
Connection parameters now carry the session's configured check and accept-undetermined revocation values, which JDBC also reports. Unit tests cover set and unset values. Circuit breakers are keyed the same way as the client cache, by host and effective revocation mode, so breakers follow the client split. A unit test shows two modes on one host get different breakers. Test-injected exporters use the same key. The cache key's limit is documented: custom CA, self-signed, mTLS and proxy settings are not in the key, as before this change.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>
…d OCSP

The status now reads the trust bits of the chain and of every element. A bad signature on any element is undetermined, so strict mode rejects it and accept-undetermined accepts it. A revoked bit stays revoked. The mapping is a pure function with unit tests on synthetic bits. A non-empty stapled OCSP response is attached to the leaf with CERT_OCSP_RESPONSE_PROP_ID, as SChannel does. An empty response is skipped, and a refused one is ignored. A Windows test shows that an empty or garbage response does not change the good or CRL-revoked outcome. A positive stapled test needs an OCSP responder fixture, which is a follow-up.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>
…y key limit

config.rs and the design doc state that a stapled OCSP response is attached to the leaf and that rustls requests OCSP stapling by default. They state the invalid-signature rule and the telemetry cache key limit, and that a positive stapled-OCSP test is a follow-up.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Terra), checked by a judge model (Claude Sonnet 5.5).

Verdict: 2 High · 2 Low

Looks good: 2 low concerns. The verifier ordering, the self-signed/unsupported gating, disabled resumption and permanent classification of revocation errors (retry.rs:274) look correct, and the CryptoAPI handles are freed by RAII guards.

This overview is Claude Opus 5.5's initial take; some of its points were set aside by the cross-check judge and GPT-6.1 Terra added findings it doesn't mention — see the findings below.

Other findings

  • 🟠 High — When a configured intermediate is a webpki trust anchor but Windows can build past it to an installed root, the default engine checks that intermediate's revocation and can reject the connection even though trust anchors must be excluded. Align the CryptoAPI chain with the selected webpki anchor, and test an intermediate anchor whose issuer is trusted by Windows. (Found by GPT-6.1 Terra · the judge couldn't confirm it)
  • 🟠 High — Disputed by the cross-check judge (it quotes /// Limit: the key covers the host and the effective revocation mode only. Sessions to one host /// with different custom CA, self-signed, mTLS or proxy settings still share a telemetry client, /// as they did before revocation was added. Per-session isolation is a follow-up.); a human should decide. Original finding: Sessions with the same host and revocation mode but different custom anchors share the first session's telemetry HTTP client, so telemetry can use a different revocation chain and credentials from those configured for its session. Isolate telemetry clients by session or include all TLS and authentication inputs in the cache key. (Found by GPT-6.1 Terra · disputed by the judge)
🔀 1 finding considered and dismissed by the judge
  • 🔵 Low src/telemetry/runtime.rs:429 — Telemetry reports the requested check_certificate_revocation, but allow_self_signed silently turns revocation off. So a session with self-signed on reports
    Judge's evidence: /// Connection parameters for telemetry. The revocation fields carry the session's configured /// values, as JDBC report…

Comment thread src/client/tls_revocation.rs Resolved
Comment thread src/client/http.rs Resolved
cathleeny and others added 3 commits November 23, 2026 16:41
When a configured custom CA is a trust anchor, but Windows can build past it to an installed root, the old reading counted the anchor's revocation and the certificates above it. An unreachable CRL for the anchor then rejected strict connections, although anchors are not checked. The status is now read from the leaf up to the first custom CA on the chain, using only the bits below it. The chain-level bits are not used once the chain is cut. A chain without a custom CA is read as before. status_from_chain is a pure function, and its tests cover an anchor in the middle, a custom CA as the root, a leaf that is itself a custom CA, and the no-custom-CA case. CI cannot install a root into the Windows store, so the root-trusted case is covered only by the pure function.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>
…are not checked

config.rs and the design doc state that a custom CA on the chain is a trust anchor, including a custom intermediate anchor, and that the certificates above it are not checked. The leaf and the certificates below an anchor are checked.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>
Resolve the NEXT_CHANGELOG.md conflict left by the 1.5.0 release: main
moved the ADBC driver entry into CHANGELOG.md and reset the file, so only
this PR's revocation entry stays under Added. Cargo.lock, Cargo.toml,
src/session.rs and the binding lockfiles merged without conflicts.
cargo fmt --check, cargo clippy --all-targets -D warnings and cargo test
pass on the merged tree on Linux.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 Low · 1 Nit

Looks good — 1 low concern. The CryptoAPI wrapper's RAII guards, the shared budget, the anchor-cut status logic, the unsupported-platform rejection and the telemetry cache-key split all look sound. One nit: circuit-breaker debug logs now show the composite host|revocation=… key instead of the bare host.

This overview is Claude Opus 5.5's initial take; GPT-6.1 Sol added findings it doesn't mention — see the findings below.

Other findings

  • ⚪ Nit — The config docs say Revoked and UnknownRevocationStatus failures are permanent and never retried. The Windows tests call client.inner().send(), which skips the retry classification layer, so they don't check this. Add cases through execute_without_auth that assert attempts == 1 and !retryable. (Found by Claude Opus 5.5 · confirmed by the judge)

Comment thread src/client/tls_revocation.rs Resolved
The Windows revocation verifier returns
InvalidCertificate(Revoked) for a revoked status and, in strict mode,
InvalidCertificate(UnknownRevocationStatus) for an undetermined one. The
config docs say both are permanent and never retried. Add both to the
classifier test, which runs in the tls-rustls job on Linux and Windows,
so a change to the classifier that would retry them fails there.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 3 Low

Looks good, with 2 low concerns. The revocation design is careful: webpki still decides trust, the custom-CA anchor rule is tested, the time budget is shared across both chain builds, and resumption is disabled. Nit: pyo3 and napi don't expose the option. The PR description says this is intentional, but NEXT_CHANGELOG doesn't mention it.

This overview is Claude Opus 5.5's initial take; GPT-6.1 Sol added findings it doesn't mention — see the findings below.

Comment thread src/client/tls_revocation.rs Resolved
Comment thread src/client/tls_revocation_tests.rs Resolved
Comment thread src/telemetry/runtime.rs Resolved
The breaker is shared per host and revocation mode, so its lookup key is
`host|revocation=<mode>`. That key was also stored as the exporter's host,
so breaker debug logs showed it as a hostname. maybe_wrap_exporter now
takes the plain host for logging and the composite key for the breaker
lookup. Sharing is unchanged; a test checks both.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: cat23123 <58714163+cat23123@users.noreply.github.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 Low

Looks good, with 1 low concern. The verifier keeps webpki in charge of trust, the CryptoAPI handles are freed through RAII guards, and the strict and accept-undetermined modes are well covered by Windows CI tests. The behaviour on unsupported platforms is rejected up front with InvalidArgument.

This overview is Claude Opus 5.5's initial take; some of its points were set aside by the cross-check judge and GPT-6.1 Sol added findings it doesn't mention — see the findings below.

🔀 1 finding considered and dismissed by the judge
  • 🔵 Low src/telemetry/runtime.rs:433 — Telemetry reports the configured check_certificate_revocation value, so a session with accept_self_signed (where revocation is actually turned off) is repor
    Judge's evidence: /// Connection parameters for telemetry. The revocation fields carry the session's configured /// values, as JDBC report…

Comment thread src/client/tls_revocation_tests.rs Resolved
fn status_from_chain(chain_bits: u32, elements: &[(&[u8], u32)], custom_cas: &[&[u8]]) -> Status {
match elements
.iter()
.position(|(der, _)| custom_cas.contains(der))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The anchor search can match index 0. Webpki matches anchors only as issuers (rustls-webpki verify_cert.rs:75-80), so a leaf that isn't self-signed is never the anchor, even if it's in the custom-CA PEM; webpki anchors at its issuer. Here elements[..0] is empty, so a revoked leaf is Good in strict mode. Example: a full-chain export (leaf + intermediate + root) used as the trusted-cert PEM, then the leaf is revoked. The test at tls_revocation_tests.rs:634-642 asserts this case. Suggest searching from index 1 (a self-signed leaf is a one-element chain, which EXCLUDE_ROOT already covers) and expecting Revoked in that test.

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- uses: ./.github/actions/setup-jfrog

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After main's #497, pr-checks.yml no longer grants id-token: write, and every job uses setup-public-package-proxies. This job still calls setup-jfrog, so it will fail the OIDC exchange once the branch is updated from main. Switch it to ./.github/actions/setup-public-package-proxies. Also, #499 already ignores RUSTSEC-2026-0543, so the CI note in the description can go.

This branch was successfully deployed

1 active deployment
azure-prod — c2b961da Deployed Nov 29, 2026 by vuanhphung via followup #4389
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants