Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CONNECTION_PARAMETERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,18 @@ until implemented) and `External` (a caller-supplied `TokenProvider`).

## `HttpConfig` — HTTP client (optional)

`http2_enabled` covers all HTTPS traffic created by the session, including
authentication, SQL and result downloads. Telemetry clients are shared per host
and may reuse an earlier session's HTTP settings. An explicit proxy URL or nonempty
`HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY` (including lowercase variants) forces
HTTP/1.1, including destinations that bypass the proxy.

| Field | Description | Default |
|-------|-------------|---------|
| `http2_enabled` | HTTP/2 with HTTP/1.1 fallback; `false` forces HTTP/1.1. | `true` |
| `request_timeout` | Per-request timeout (connect + body). | `120s` |
| `overall_timeout` | Maximum total time across retries for one logical RPC. | `900s` |
| `pool_max_idle_per_host` | Connection-pool size (max idle warm sockets per host). Raise for bursty concurrent workloads. | `100` |
| `pool_max_idle_per_host` | Maximum idle connections retained per host. HTTP/1.1 concurrency can use multiple sockets; HTTP/2 multiplexes requests on a shared connection. This does not limit active requests or HTTP/2 streams. | `100` |
| `retry_min_wait` | Minimum backoff between retries; also the floor for a server `Retry-After` and the base of exponential backoff (`min_wait × 2^attempt`). | `1s` |
| `retry_max_wait` | Maximum backoff between retries; caps both the exponential backoff and a server `Retry-After`. | `60s` |
| `retry_max_retries` | Max retries **after** the first attempt — a request is tried at most `retry_max_retries + 1` times. | `5` (→ 6 total attempts) |
Expand Down
8 changes: 6 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ arrow-ipc = "59"
# (which `native-tls` pulls in on Linux) collides with Node's symbols at
# module load time and segfaults the process before any Rust code runs.
# `rustls` is pure Rust + ring and avoids the conflict entirely.
reqwest = { version = "0.12", default-features = false, features = ["json", "gzip", "stream"] }
reqwest = { version = "0.12", default-features = false, features = ["json", "gzip", "stream", "http2"] }

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.

hyper accepts h2 0.4.14, so a consumer lockfile on 0.4.15 keeps RUSTSEC-2026-0258 after this lands, and this PR puts h2 on the default path. Could we add an h2 minimum (e.g. 0.4.20) to [dependencies], like the TLS minimums below?

native-tls = { version = "0.2", optional = true }
rustls = { version = "0.23.41", optional = true, default-features = false, features = ["ring", "std", "tls12"] }
# Enforce TLS dependency minimums for consumers with their own lockfiles.
Expand Down Expand Up @@ -150,6 +150,9 @@ tokio = { version = "1", features = ["rt-multi-thread", "macros", "net", "io-uti
wiremock = "0.6"
tempfile = "3"
log = "0.4"
bytes = "1"
h2 = "0.4"
http = "1"
# Generate JWT test keys in-process to avoid PEM fixtures and an external
# `openssl` dependency. `ring` already backs runtime JWT signing.
rsa = { version = "0.9", features = ["pem"] }
Expand Down Expand Up @@ -195,7 +198,7 @@ tokio-rustls = { version = "0.26.4", default-features = false, features = ["ring
# guarantee — items 1 and 2 above are.
[features]
default = ["tls-native"]
tls-native = ["reqwest/native-tls", "dep:native-tls"]
tls-native = ["reqwest/native-tls-alpn", "dep:native-tls"]
# `rustls-tls` alone is `reqwest/rustls-tls-webpki-roots` — the bundled Mozilla
# root set only, which does NOT read the OS system trust store. `tls-native`
# (native-tls → OpenSSL) DOES read `/etc/ssl/...`, so a `tls-rustls` build behind
Expand Down
7 changes: 7 additions & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ changes go in their respective binding's NEXT_CHANGELOG.

### Changed

- HTTPS requests negotiate HTTP/2 with HTTP/1.1 fallback by default when no
proxy is configured. Explicit or environment proxy configuration forces
HTTP/1.1 for the entire client. Set
`HttpConfig.http2_enabled` to `false`, or use
`kernel_session_config_set_http2_enabled(config, false)`, to force HTTP/1.1.
Rust ADBC exposes `adbc.databricks.http.http2_enabled`.

- Rust ADBC requests identify themselves as `RustADBCDatabricksDriver/<version>`
with an optional partner entry from `adbc.databricks.user_agent_entry`
(`adbc.spark.user_agent_entry` is a compatibility alias). `User-Agent` in
Expand Down
51 changes: 51 additions & 0 deletions adbc/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion adbc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ The main database option families are:
| Namespace | `adbc.databricks.catalog`, `adbc.databricks.schema` |
| Attribution | `adbc.databricks.user_agent_entry` |
| Session | `adbc.databricks.session_conf.<name>`, `adbc.databricks.ssp_ansi_mode`, `adbc.databricks.ssp_timezone`, `adbc.databricks.query_tags` |
| HTTP | request/overall timeouts, idle pool size, retry limits/backoff, response compression, JSON custom headers |
| HTTP | HTTP/2 negotiation, request/overall timeouts, idle pool size, retry limits/backoff, response compression, JSON custom headers |
| Proxy | URL, username, password, bypass hosts |
| TLS/mTLS | CA file or PEM, client certificate/key file or PEM, self-signed and hostname-verification controls |
| Logging | filter and file |
Expand All @@ -107,6 +107,10 @@ The main database option families are:
| Execution | `adbc.databricks.enable_direct_results` (default `true`); set `false` to use `wait_timeout=0s` and status polling |
| Metadata | `adbc.databricks.metadata.escape_catalog_name` |

HTTPS requests negotiate HTTP/2 with HTTP/1.1 fallback by default. Set
`adbc.databricks.http.http2_enabled` to `false` to force HTTP/1.1 for session
HTTPS traffic. Configured proxies force HTTP/1.1, including bypassed destinations.

The optional user-agent entry is appended to the driver-owned identity as
`RustADBCDatabricksDriver/<version> (<entry>)`. Set it through
`adbc.databricks.user_agent_entry`; `User-Agent` is not accepted in the generic
Expand Down
14 changes: 14 additions & 0 deletions adbc/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ impl DatabaseConfig {

fn set_http(&mut self, key: &str, value: OptionValue) -> Result<()> {
match key {
"adbc.databricks.http.http2_enabled" => self.http.http2_enabled = boolean(value, key)?,
"adbc.databricks.http.request_timeout_ms" => {
self.http.request_timeout = duration(value, key, false)?
}
Expand Down Expand Up @@ -1692,6 +1693,19 @@ mod tests {
}
}

#[test]
fn http2_default_and_opt_out_reach_kernel_config() {
let mut config = DatabaseConfig::default();
set(&mut config, HOST, "https://example.databricks.com");
set(&mut config, HTTP_PATH, "/sql/1.0/warehouses/warehouse-id");
set(&mut config, ACCESS_TOKEN, "sentinel-token");
assert!(config.resolve().unwrap().http.http2_enabled);
for enabled in [false, true] {
set(&mut config, "adbc.databricks.http.http2_enabled", enabled);
assert_eq!(config.resolve().unwrap().http.http2_enabled, enabled);
}
}

#[test]
fn http_pool_and_custom_headers_reach_kernel_config() {
let mut config = DatabaseConfig::default();
Expand Down
11 changes: 0 additions & 11 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@ ignore = [
# type, so exercising the RSA load+sign path in tests has value.
# Re-evaluate when `rsa` ships a constant-time stable release.
"RUSTSEC-2023-0071",
# RUSTSEC-2026-0258 — "h2 unbounded empty DATA frames". A DoS advisory
# in `h2 0.4.15`, pulled in transitively via `hyper` <- `reqwest`
# (`cargo tree -i h2`); not a direct dependency and unrelated to this
# crate's code. 0.4.15 is already the latest 0.4.x (a `cargo update -p
# h2` is a no-op), so it cannot be cleared by a bump; clearing it needs
# an upstream `hyper`/`reqwest` release that requires the fixed `h2`.
# The advisory concerns a server-side frame-flood; the kernel is an
# HTTP *client* to Databricks SEA, so the attack surface is not exercised
# here. Pre-existing on `main` (fires against the shared reqwest stack,
# not this PR). Re-evaluate when the reqwest/hyper stack picks up the fix.
"RUSTSEC-2026-0258",
]

[licenses]
Expand Down
5 changes: 5 additions & 0 deletions include/databricks_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,11 @@ KernelStatusCode kernel_session_config_set_enable_geospatial_support(
KernelStatusCode kernel_session_config_set_custom_header(KernelSessionConfig* config,
const char* name, const char* value);

/* Negotiate HTTP/2 for session HTTPS requests, with HTTP/1.1 fallback.
* Enabled by default. False or a configured proxy forces HTTP/1.1. */
KernelStatusCode kernel_session_config_set_http2_enabled(
KernelSessionConfig* config, bool enabled);

/* Configure whether authenticated SEA responses may use HTTP compression.
* Disabled by default. */
KernelStatusCode kernel_session_config_set_sea_response_compression_enabled(
Expand Down
5 changes: 3 additions & 2 deletions napi/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions napi/NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ layout, or npm publishing. Pure-kernel changes go in the root

### Added

- `ConnectionOptions.enableHttp2` selects HTTP/2 negotiation for HTTPS requests.
It defaults to enabled; set it to `false` to force HTTP/1.1. Configured proxies
force HTTP/1.1 for the entire kernel client.

### Changed

### Updated
Expand Down
2 changes: 2 additions & 0 deletions napi/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,8 @@ export interface ConnectionOptions {
* Whether SEA API responses may use HTTP compression. Defaults to false.
*/
seaResponseCompressionEnabled?: boolean
/** Negotiate HTTP/2 over HTTPS by default. False or a configured proxy forces HTTP/1.1. */
enableHttp2?: boolean
/**
* Retry/backoff tuning — all optional. An unset field keeps the kernel's
* built-in policy (1s/60s exponential backoff, 6 total attempts, 900s
Expand Down
19 changes: 19 additions & 0 deletions napi/src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,9 @@ pub struct ConnectionOptions {
/// Whether SEA API responses may use HTTP compression. Defaults to false.
pub sea_response_compression_enabled: Option<bool>,

/// Negotiate HTTP/2 over HTTPS by default. False or a configured proxy forces HTTP/1.1.
pub enable_http2: Option<bool>,

/// Retry/backoff tuning — all optional. An unset field keeps the kernel's
/// built-in policy (1s/60s exponential backoff, 6 total attempts, 900s
/// budget). Mirrors the pyo3 binding's `retry_*` kwargs so the Node.js
Expand Down Expand Up @@ -624,6 +627,9 @@ fn build_tls_config(options: &ConnectionOptions) -> TlsConfig {
/// strings.
fn build_http_config(options: &mut ConnectionOptions) -> HttpConfig {
let mut http = HttpConfig::default();
if let Some(enabled) = options.enable_http2 {
http.http2_enabled = enabled;
}
http.sea_response_compression_enabled =
options.sea_response_compression_enabled.unwrap_or(false);
http.pool_max_idle_per_host = options
Expand Down Expand Up @@ -955,6 +961,7 @@ mod tests {
client_key_pem: None,
custom_headers: None,
sea_response_compression_enabled: None,
enable_http2: None,
retry_min_wait_secs: None,
retry_max_wait_secs: None,
retry_max_attempts: None,
Expand Down Expand Up @@ -1574,6 +1581,18 @@ mod tests {
assert_eq!(http.custom_headers[1].1, "Connector/2.0");
}

#[test]
fn http2_option_preserves_default_and_opt_out() {
for enabled in [None, Some(true), Some(false)] {
let mut options = base();
options.enable_http2 = enabled;
assert_eq!(
build_http_config(&mut options).http2_enabled,
enabled.unwrap_or(true)
);
}
}

#[test]
fn sea_response_compression_option_maps_to_http_config() {
let mut defaults = base();
Expand Down
22 changes: 0 additions & 22 deletions osv-scanner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,3 @@ id = "GHSA-h395-gr6q-cpjc"
# ring-backed 10.x if one exists) before renewing.
ignoreUntil = 2027-02-14
reason = "jsonwebtoken claim-validation bug (CVE-2026-25537) is in the decode path; the kernel only signs, never decodes/validates JWTs (verified: no decode/Validation calls in src/). Upgrade to 10.x deferred — it forces rust_crypto (rsa/RUSTSEC-2023-0071 in runtime) or aws_lc_rs (C dep). Re-review on expiry."

[[IgnoredVulns]]
id = "RUSTSEC-2026-0258"
# "h2 unbounded empty DATA frames" — a DoS advisory in `h2 0.4.15`, pulled in
# transitively via `hyper` <- `reqwest` (`cargo tree -i h2`). Not a direct
# dependency and unrelated to this crate's code; pre-existing on `main` (fires
# against the shared reqwest/hyper stack, not this PR).
#
# Not reachable in the way the advisory describes: it concerns a SERVER
# accepting a flood of empty DATA frames; the kernel is an HTTP *client* to
# Databricks SEA and never runs an h2 server, so the affected entrypoint is
# not exposed.
#
# Cannot be cleared by a bump: 0.4.15 is already the latest 0.4.x
# (`cargo update -p h2` is a no-op); clearing it needs an upstream
# `reqwest`/`hyper` release that pulls the fixed `h2`.
#
# ignoreUntil forces periodic re-review: when it lapses OSV re-reports the
# finding, and someone must reconfirm the client-only posture (and re-check
# for a reqwest/hyper release carrying the fix) before renewing.
ignoreUntil = 2027-02-14
reason = "h2 (RUSTSEC-2026-0258) DoS is a server-side empty-DATA-frame flood; the kernel is an HTTP client only and runs no h2 server. Transitive via reqwest/hyper, pre-existing on main, latest 0.4.x so no bump available. Re-review on expiry."
Loading
Loading