From 252e16262fa0ba3f476a0c4ca71a5bd4c2fd274d Mon Sep 17 00:00:00 2001 From: Shimin Lin <135086178+shiminlin-db@users.noreply.github.com> Date: Mon, 23 Nov 2026 20:55:39 +0000 Subject: [PATCH 1/5] fix(pyo3): allow pyarrow 24-26 so consumers can clear CVE-2026-92287 The published wheel declared pyarrow>=23.0.1,<24 for Python 3.10+, which made `pip install "databricks-sql-connector[kernel]" "pyarrow>=26"` unresolvable; pyarrow 26.0.0 is the first release without CVE-2026-92287 (apache/arrow#51349). The ceiling moves to <27, keeping the major-version bound the pinning policy requires. Python 3.10 resolves to 25.x because pyarrow 26 requires Python 3.11. Adds tests/test_dependency_bounds.py, which reads the installed Requires-Dist and fails if the 3.10+ range drops back below 26.0.0 or excludes the installed pyarrow. Refs databricks/databricks-sql-python#1076 Signed-off-by: Shimin Lin <135086178+shiminlin-db@users.noreply.github.com> --- pyo3/CHANGELOG.md | 4 ++ pyo3/pyproject.toml | 16 ++++++-- pyo3/tests/test_dependency_bounds.py | 61 ++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 pyo3/tests/test_dependency_bounds.py diff --git a/pyo3/CHANGELOG.md b/pyo3/CHANGELOG.md index 1c74a988..282d4cd7 100644 --- a/pyo3/CHANGELOG.md +++ b/pyo3/CHANGELOG.md @@ -11,6 +11,10 @@ they ship on independent cadences. ### Added ### Changed +- Allow pyarrow 24.x through 26.x on Python 3.10+ (`pyarrow>=23.0.1,<27`), + so the wheel installs alongside pyarrow 26, the first release clear of + CVE-2026-92287. Python 3.10 resolves to pyarrow 25.x because pyarrow 26 + requires Python 3.11. ### Fixed diff --git a/pyo3/pyproject.toml b/pyo3/pyproject.toml index 1750e86c..bd592cb4 100644 --- a/pyo3/pyproject.toml +++ b/pyo3/pyproject.toml @@ -29,16 +29,26 @@ authors = [{ name = "Databricks" }] # (Python 3.14) wheels from 23.x onward, so an older ceiling forces # a from-source build that fails on 3.14. Keeping the floor aligned # with the connector also keeps the two surfaces installable side -# by side. +# by side. The ceiling must admit 26.x: every pyarrow below 26.0.0 +# is flagged by CVE-2026-92287 (apache/arrow#51349; a Parquet KMS +# decryption path this binding never calls), and a `<24` ceiling +# made `pip install "databricks-sql-connector[kernel]" "pyarrow>=26"` +# unresolvable (databricks/databricks-sql-python#1076). pyarrow 26 +# needs Python >= 3.11, so 3.10 resolves to 25.x inside this bound. +# The handoff uses arrow-pyarrow's C Data Interface calls +# (`_import_from_c` / `__arrow_c_*`), which pyarrow keeps stable +# across these majors; `tests/test_fetch.py` exercises it offline. # * Python 3.9: pyarrow 23.x dropped 3.9 wheels, so 3.9 takes the # last series that still ships them (`>=14,<19`). 3.9 never sees # 3.14, so the cp314 concern does not apply here. # -# Both `<24` / `<19` ceilings preserve the major-version upper bound +# Both `<27` / `<19` ceilings preserve the major-version upper bound # the go/pinning-python-deps policy requires (a future pyarrow major # then surfaces as a deliberate bump, not a silent auto-resolve). +# `tests/test_dependency_bounds.py` keeps the 3.10+ ceiling from +# dropping back below 26.0.0. dependencies = [ - "pyarrow>=23.0.1,<24; python_version >= '3.10'", + "pyarrow>=23.0.1,<27; python_version >= '3.10'", "pyarrow>=14,<19; python_version < '3.10'", ] diff --git a/pyo3/tests/test_dependency_bounds.py b/pyo3/tests/test_dependency_bounds.py new file mode 100644 index 00000000..2dd6851a --- /dev/null +++ b/pyo3/tests/test_dependency_bounds.py @@ -0,0 +1,61 @@ +# Copyright (c) 2026 Databricks, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Published dependency bounds of the wheel. + +The pyarrow range is the only dependency metadata end-users resolve +against, so these tests read the installed distribution's +``Requires-Dist`` (what ``maturin develop`` / ``pip`` see) rather than +``pyproject.toml``. +""" + +from __future__ import annotations + +import sys +from importlib.metadata import requires + +import pyarrow +import pytest +from packaging.requirements import Requirement +from packaging.version import Version + +# First pyarrow release without CVE-2026-92287 (apache/arrow#51349). +PYARROW_CVE_2026_92287_FIXED = Version("26.0.0") + + +def pyarrow_requirement() -> Requirement: + """The pyarrow requirement whose environment marker matches this interpreter.""" + matching = [ + req + for req in (Requirement(r) for r in requires("databricks-sql-kernel") or []) + if req.name == "pyarrow" and (req.marker is None or req.marker.evaluate()) + ] + assert len(matching) == 1, f"expected one pyarrow requirement for this interpreter, got {matching}" + return matching[0] + + +def test_installed_pyarrow_satisfies_declared_range(): + req = pyarrow_requirement() + assert req.specifier.contains(pyarrow.__version__, prereleases=True), ( + f"installed pyarrow {pyarrow.__version__} is outside the declared range {req.specifier}" + ) + + +@pytest.mark.skipif(sys.version_info < (3, 10), reason="pyarrow 26 ships no Python 3.9 wheels") +def test_declared_range_admits_pyarrow_clear_of_cve_2026_92287(): + req = pyarrow_requirement() + assert req.specifier.contains(PYARROW_CVE_2026_92287_FIXED), ( + f"declared range {req.specifier} excludes pyarrow {PYARROW_CVE_2026_92287_FIXED}; " + "consumers could not install a pyarrow clear of CVE-2026-92287" + ) From 504ea320120738e4b5c875ca8390ab7d729b6aec Mon Sep 17 00:00:00 2001 From: Shimin Lin <135086178+shiminlin-db@users.noreply.github.com> Date: Mon, 23 Nov 2026 20:57:56 +0000 Subject: [PATCH 2/5] style(pyo3): wrap a long assertion message in test_dependency_bounds Co-authored-by: Isaac Signed-off-by: Shimin Lin <135086178+shiminlin-db@users.noreply.github.com> --- pyo3/tests/test_dependency_bounds.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyo3/tests/test_dependency_bounds.py b/pyo3/tests/test_dependency_bounds.py index 2dd6851a..d6a63a94 100644 --- a/pyo3/tests/test_dependency_bounds.py +++ b/pyo3/tests/test_dependency_bounds.py @@ -41,7 +41,9 @@ def pyarrow_requirement() -> Requirement: for req in (Requirement(r) for r in requires("databricks-sql-kernel") or []) if req.name == "pyarrow" and (req.marker is None or req.marker.evaluate()) ] - assert len(matching) == 1, f"expected one pyarrow requirement for this interpreter, got {matching}" + assert len(matching) == 1, ( + f"expected one pyarrow requirement for this interpreter, got {matching}" + ) return matching[0] From 576f164c0bcec7c843c2f7b7a53f382b0e413f02 Mon Sep 17 00:00:00 2001 From: Shimin Lin <135086178+shiminlin-db@users.noreply.github.com> Date: Mon, 23 Nov 2026 21:10:52 +0000 Subject: [PATCH 3/5] fix(pyo3): stage the pyarrow bound change in NEXT_CHANGELOG, declare packaging Unreleased wheel changes belong in pyo3/NEXT_CHANGELOG.md; CHANGELOG.md only moves at release time. The entry now also names the behavior change for unpinned [kernel] installs (pyarrow 23 -> 26 on 3.11+, 25 on 3.10) and the pin that opts out. The pyproject comment now states what was tested (24.0.0, 25.0.1, 26.0.1) instead of a blanket stability claim, and the dev group declares packaging, which tests/test_dependency_bounds.py imports. Co-authored-by: Isaac Signed-off-by: Shimin Lin <135086178+shiminlin-db@users.noreply.github.com> --- pyo3/CHANGELOG.md | 4 ---- pyo3/NEXT_CHANGELOG.md | 5 +++++ pyo3/pyproject.toml | 9 ++++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/pyo3/CHANGELOG.md b/pyo3/CHANGELOG.md index 282d4cd7..1c74a988 100644 --- a/pyo3/CHANGELOG.md +++ b/pyo3/CHANGELOG.md @@ -11,10 +11,6 @@ they ship on independent cadences. ### Added ### Changed -- Allow pyarrow 24.x through 26.x on Python 3.10+ (`pyarrow>=23.0.1,<27`), - so the wheel installs alongside pyarrow 26, the first release clear of - CVE-2026-92287. Python 3.10 resolves to pyarrow 25.x because pyarrow 26 - requires Python 3.11. ### Fixed diff --git a/pyo3/NEXT_CHANGELOG.md b/pyo3/NEXT_CHANGELOG.md index e0881e54..889094f0 100644 --- a/pyo3/NEXT_CHANGELOG.md +++ b/pyo3/NEXT_CHANGELOG.md @@ -14,6 +14,11 @@ changes go in the root `NEXT_CHANGELOG.md`. ### Added ### Changed +- Allow pyarrow 24.x through 26.x on Python 3.10+ (`pyarrow>=23.0.1,<27`), + so the wheel installs alongside pyarrow 26, the first release clear of + CVE-2026-92287. Fresh `[kernel]` installs without their own pyarrow pin now + resolve pyarrow 26 on Python 3.11+ (25.x on 3.10); pin `pyarrow<24` to stay + on 23.x. ### Updated diff --git a/pyo3/pyproject.toml b/pyo3/pyproject.toml index bd592cb4..a226085c 100644 --- a/pyo3/pyproject.toml +++ b/pyo3/pyproject.toml @@ -29,15 +29,15 @@ authors = [{ name = "Databricks" }] # (Python 3.14) wheels from 23.x onward, so an older ceiling forces # a from-source build that fails on 3.14. Keeping the floor aligned # with the connector also keeps the two surfaces installable side -# by side. The ceiling must admit 26.x: every pyarrow below 26.0.0 +# by side. The ceiling must admit 26.x: pyarrow 8.0.0 through 25.x # is flagged by CVE-2026-92287 (apache/arrow#51349; a Parquet KMS # decryption path this binding never calls), and a `<24` ceiling # made `pip install "databricks-sql-connector[kernel]" "pyarrow>=26"` # unresolvable (databricks/databricks-sql-python#1076). pyarrow 26 # needs Python >= 3.11, so 3.10 resolves to 25.x inside this bound. # The handoff uses arrow-pyarrow's C Data Interface calls -# (`_import_from_c` / `__arrow_c_*`), which pyarrow keeps stable -# across these majors; `tests/test_fetch.py` exercises it offline. +# (`_import_from_c` / `__arrow_c_*`); the offline `tests/test_fetch.py` +# handoff tests pass with pyarrow 24.0.0, 25.0.1 and 26.0.1. # * Python 3.9: pyarrow 23.x dropped 3.9 wheels, so 3.9 takes the # last series that still ships them (`>=14,<19`). 3.9 never sees # 3.14, so the cp314 concern does not apply here. @@ -63,6 +63,9 @@ dependencies = [ dev = [ "maturin>=1.7,<2.0", "pytest>=8.3,<9.0", + # tests/test_dependency_bounds.py parses Requires-Dist with it; pytest + # happens to pull it in, but the test must not rely on that. + "packaging>=24,<27", ] [tool.maturin] From f3212546923d00e70bb60fe5a0984739529cc248 Mon Sep 17 00:00:00 2001 From: Shimin Lin <135086178+shiminlin-db@users.noreply.github.com> Date: Mon, 23 Nov 2026 23:06:51 +0000 Subject: [PATCH 4/5] ci(pyo3): test the declared pyarrow floor alongside the newest release `uv sync` resolves the newest pyarrow inside the bound, so after widening the range to `>=23.0.1,<27` the default matrix legs never exercised 23.x. One extra leg (Python 3.12) pins pyarrow==23.0.1 after the sync so a kernel change that breaks on the oldest supported pyarrow fails CI. The default legs keep their check names. Co-authored-by: Isaac Signed-off-by: Shimin Lin <135086178+shiminlin-db@users.noreply.github.com> --- .github/workflows/pyo3-checks.yml | 21 ++++++++++++++++++++- pyo3/pyproject.toml | 4 +++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pyo3-checks.yml b/.github/workflows/pyo3-checks.yml index 1dda66f7..c116fe9e 100644 --- a/.github/workflows/pyo3-checks.yml +++ b/.github/workflows/pyo3-checks.yml @@ -52,7 +52,10 @@ defaults: jobs: build-and-test: - name: "PyO3 build + test (Python ${{ matrix.python-version }})" + # The name stays "PyO3 build + test (Python 3.x)" for the default + # legs so existing required-check rules keep matching; only the + # floor leg gets a suffix. + name: "PyO3 build + test (Python ${{ matrix.python-version }}${{ matrix.pyarrow != 'latest' && format(', pyarrow {0}', matrix.pyarrow) || '' }})" runs-on: group: databricks-protected-runner-group labels: linux-ubuntu-latest @@ -82,6 +85,15 @@ jobs: # the older `pyarrow>=14,<19` series via the env-marker split # in pyproject.toml, exercising that path in CI.) python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] + # `uv sync` resolves the newest pyarrow inside the declared bound, + # so the default legs only ever see the top of `>=23.0.1,<27`. + # The include below adds one leg pinned to the floor, so a kernel + # change that breaks on the oldest supported pyarrow fails CI + # instead of a user's install. + pyarrow: ["latest"] + include: + - python-version: "3.12" + pyarrow: "23.0.1" steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -132,6 +144,13 @@ jobs: # the extension twice per matrix entry. run: uv sync --group dev --no-install-project + - name: Pin pyarrow to the declared floor + if: matrix.pyarrow != 'latest' + working-directory: pyo3 + # Replaces the newest-in-bound pyarrow that `uv sync` picked. The + # later `uv run --no-sync` steps keep this pin in place. + run: uv pip install "pyarrow==${{ matrix.pyarrow }}" + - name: Cargo unit tests (pyo3 crate) # The pyo3 crate's Rust-side unit tests cover the GIL handoff # in isolation. Runs before any maturin build so a pure-Rust diff --git a/pyo3/pyproject.toml b/pyo3/pyproject.toml index a226085c..657e9170 100644 --- a/pyo3/pyproject.toml +++ b/pyo3/pyproject.toml @@ -37,7 +37,9 @@ authors = [{ name = "Databricks" }] # needs Python >= 3.11, so 3.10 resolves to 25.x inside this bound. # The handoff uses arrow-pyarrow's C Data Interface calls # (`_import_from_c` / `__arrow_c_*`); the offline `tests/test_fetch.py` -# handoff tests pass with pyarrow 24.0.0, 25.0.1 and 26.0.1. +# handoff tests pass with pyarrow 24.0.0, 25.0.1 and 26.0.1, and +# `pyo3-checks.yml` runs one leg pinned to the 23.0.1 floor next to +# the newest-in-bound legs. # * Python 3.9: pyarrow 23.x dropped 3.9 wheels, so 3.9 takes the # last series that still ships them (`>=14,<19`). 3.9 never sees # 3.14, so the cp314 concern does not apply here. From dce4e0fad4ea00cc8e13f564468a28e832e26437 Mon Sep 17 00:00:00 2001 From: Vu Anh Phung Date: Wed, 2 Dec 2026 08:18:57 +0000 Subject: [PATCH 5/5] fix(pyo3): address pyarrow compatibility review feedback Signed-off-by: Vu Anh Phung --- .github/workflows/pyo3-checks.yml | 27 ++++++++++++--------------- pyo3/NEXT_CHANGELOG.md | 3 ++- pyo3/pyproject.toml | 21 +++------------------ pyo3/tests/test_dependency_bounds.py | 2 +- 4 files changed, 18 insertions(+), 35 deletions(-) diff --git a/.github/workflows/pyo3-checks.yml b/.github/workflows/pyo3-checks.yml index 9b45b442..5303cd4d 100644 --- a/.github/workflows/pyo3-checks.yml +++ b/.github/workflows/pyo3-checks.yml @@ -52,9 +52,6 @@ defaults: jobs: build-and-test: - # The name stays "PyO3 build + test (Python 3.x)" for the default - # legs so existing required-check rules keep matching; only the - # floor leg gets a suffix. name: "PyO3 build + test (Python ${{ matrix.python-version }}${{ matrix.pyarrow != 'latest' && format(', pyarrow {0}', matrix.pyarrow) || '' }})" if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository permissions: @@ -145,13 +142,6 @@ jobs: # the extension twice per matrix entry. run: uv sync --group dev --no-install-project - - name: Pin pyarrow to the declared floor - if: matrix.pyarrow != 'latest' - working-directory: pyo3 - # Replaces the newest-in-bound pyarrow that `uv sync` picked. The - # later `uv run --no-sync` steps keep this pin in place. - run: uv pip install "pyarrow==${{ matrix.pyarrow }}" - - name: Cargo unit tests (pyo3 crate) # The pyo3 crate's Rust-side unit tests cover the GIL handoff # in isolation. Runs before any maturin build so a pure-Rust @@ -180,6 +170,13 @@ jobs: # asks maturin to build and install it a second time. run: uv run --no-sync maturin develop + - name: Pin pyarrow to the declared floor + if: matrix.pyarrow != 'latest' + working-directory: pyo3 + # Pin after maturin installs dependencies so a stale floor fails the + # installed-dependency check instead of being silently upgraded. + run: uv pip install "pyarrow==${{ matrix.pyarrow }}" + - name: pytest (no-network + live tiers) working-directory: pyo3 # `conftest.py` decorates the warehouse-bound tests with @@ -244,11 +241,6 @@ jobs: working-directory: pyo3 run: uv sync --group dev --no-install-project - - name: Pin pyarrow to the declared floor - if: matrix.pyarrow != 'latest' - working-directory: pyo3 - run: uv pip install "pyarrow==${{ matrix.pyarrow }}" - - name: Cargo unit tests working-directory: pyo3 run: cargo test @@ -257,6 +249,11 @@ jobs: working-directory: pyo3 run: uv run --no-sync maturin develop + - name: Pin pyarrow to the declared floor + if: matrix.pyarrow != 'latest' + working-directory: pyo3 + run: uv pip install "pyarrow==${{ matrix.pyarrow }}" + - name: Run no-network tests working-directory: pyo3 run: uv run --no-sync pytest -v diff --git a/pyo3/NEXT_CHANGELOG.md b/pyo3/NEXT_CHANGELOG.md index dccd7d25..d8233cd8 100644 --- a/pyo3/NEXT_CHANGELOG.md +++ b/pyo3/NEXT_CHANGELOG.md @@ -22,7 +22,8 @@ changes go in the root `NEXT_CHANGELOG.md`. so the wheel installs alongside pyarrow 26, the first release clear of CVE-2026-92287. Fresh `[kernel]` installs without their own pyarrow pin now resolve pyarrow 26 on Python 3.11+ (25.x on 3.10); pin `pyarrow<24` to stay - on 23.x. + on 23.x. Python 3.9/3.10 have no fixed pyarrow release available; + upgrade to Python 3.11+ to clear the CVE. ### Updated diff --git a/pyo3/pyproject.toml b/pyo3/pyproject.toml index 657e9170..9d8c1109 100644 --- a/pyo3/pyproject.toml +++ b/pyo3/pyproject.toml @@ -24,22 +24,9 @@ authors = [{ name = "Databricks" }] # Split by interpreter via PEP 508 environment markers because the # two ends of the supported range need different pyarrow floors: # -# * Python 3.10+: `>=23.0.1` matches databricks-sql-connector 5.0.0 -# (databricks/databricks-sql-python#818). pyarrow only ships cp314 -# (Python 3.14) wheels from 23.x onward, so an older ceiling forces -# a from-source build that fails on 3.14. Keeping the floor aligned -# with the connector also keeps the two surfaces installable side -# by side. The ceiling must admit 26.x: pyarrow 8.0.0 through 25.x -# is flagged by CVE-2026-92287 (apache/arrow#51349; a Parquet KMS -# decryption path this binding never calls), and a `<24` ceiling -# made `pip install "databricks-sql-connector[kernel]" "pyarrow>=26"` -# unresolvable (databricks/databricks-sql-python#1076). pyarrow 26 -# needs Python >= 3.11, so 3.10 resolves to 25.x inside this bound. -# The handoff uses arrow-pyarrow's C Data Interface calls -# (`_import_from_c` / `__arrow_c_*`); the offline `tests/test_fetch.py` -# handoff tests pass with pyarrow 24.0.0, 25.0.1 and 26.0.1, and -# `pyo3-checks.yml` runs one leg pinned to the 23.0.1 floor next to -# the newest-in-bound legs. +# * Python 3.10+: retain the connector's >=23.0.1 floor; <27 admits +# the CVE-2026-92287 fix in 26.x, which requires Python 3.11+. +# Python 3.10 resolves to 25.x. # * Python 3.9: pyarrow 23.x dropped 3.9 wheels, so 3.9 takes the # last series that still ships them (`>=14,<19`). 3.9 never sees # 3.14, so the cp314 concern does not apply here. @@ -47,8 +34,6 @@ authors = [{ name = "Databricks" }] # Both `<27` / `<19` ceilings preserve the major-version upper bound # the go/pinning-python-deps policy requires (a future pyarrow major # then surfaces as a deliberate bump, not a silent auto-resolve). -# `tests/test_dependency_bounds.py` keeps the 3.10+ ceiling from -# dropping back below 26.0.0. dependencies = [ "pyarrow>=23.0.1,<27; python_version >= '3.10'", "pyarrow>=14,<19; python_version < '3.10'", diff --git a/pyo3/tests/test_dependency_bounds.py b/pyo3/tests/test_dependency_bounds.py index d6a63a94..3609f9cd 100644 --- a/pyo3/tests/test_dependency_bounds.py +++ b/pyo3/tests/test_dependency_bounds.py @@ -54,7 +54,7 @@ def test_installed_pyarrow_satisfies_declared_range(): ) -@pytest.mark.skipif(sys.version_info < (3, 10), reason="pyarrow 26 ships no Python 3.9 wheels") +@pytest.mark.skipif(sys.version_info < (3, 10), reason="Python 3.9 caps pyarrow at <19") def test_declared_range_admits_pyarrow_clear_of_cve_2026_92287(): req = pyarrow_requirement() assert req.specifier.contains(PYARROW_CVE_2026_92287_FIXED), (