Skip to content

chore(ci): route registry traffic through JFrog + uv-based Python pinning - #31

Merged
gopalldb merged 3 commits into
mainfrom
chore/hardened-gha-pinning
May 21, 2026
Merged

gopalldb merged 3 commits into
mainfrom
chore/hardened-gha-pinning

Conversation

@gopalldb

@gopalldb gopalldb commented May 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Implements the SHA-pinning portion of go/hardened-gha and adopts the go/pinning-python-deps externally-published-library guidance for the pyo3 sub-crate.

Background: per the hardened-runners policy, direct access to public package registries (crates.io, PyPI) is blocked at the Databricks-protected runner. Everything goes through databricks.jfrog.io. This is also why repo Actions runs have been silently 0 — workflows would have hit blocked registries even if Actions were enabled.

Composite action — .github/actions/setup-jfrog

Encapsulates the OIDC token exchange + cargo / uv index-URL writes. Workflows that need crates.io or PyPI access call:

- uses: ./.github/actions/setup-jfrog
  with:
    cargo: "true"  # write ~/.cargo/config.toml -> db-cargo-remote
    uv: "true"     # export UV_INDEX_URL / PIP_INDEX_URL -> db-pypi

Both pull from databricks.jfrog.io via a GitHub-OIDC-minted access token. The composite requires permissions: id-token: write on the calling job.

Workflow updates

Workflow Cargo proxy uv proxy Notes
pr-checks.yml clippy + test — fmt doesn't fetch deps, skipped
coverage.yml ✅ — cargo-llvm-cov via taiki-e/install-action downloads from GitHub Releases (no registry hit)
license-check.yml ✅ — for cargo deny check
rust-e2e.yml ✅ — live workspace creds unchanged
pyo3-checks.yml ✅ ✅ bootstrap shifts from pip install 'maturin>=...' pytest to astral-sh/setup-uv + uv sync --group dev

All five workflows gain permissions: id-token: write (some already had it from prior OIDC integrations).

Python pinning — pyo3/pyproject.toml

The pyo3 wheel ships externally as databricks-sql-kernel. Per the externally-published-library section of go/pinning-python-deps:

"Do add an upper bound on the major version of your dependencies."
"Do not add exact version pins for all of your dependencies. Doing this makes your library harder for your end users to install."

So:

  • [project].dependencies gains a major-version upper bound: pyarrow>=14 → pyarrow>=14,<19.
  • [dependency-groups].dev (PEP 735) lists maturin>=1.7,<2.0 and pytest>=8.3,<9.0. uv reads this natively for uv sync --group dev.
  • No uv.lock committed, no --frozen flag in CI. uv re-resolves each run within the major-version bounds.

The db-pypi proxy's 7-day age filter is the baseline supply-chain protection at the registry layer.

CLAUDE.md

Adds a "Supply-chain hardening" section documenting:

  • SHA-pinning policy (actions, cargo).
  • Python dep pinning rule (published-library: major-bound, no exact pins, no lockfile).
  • How the composite works.

Test plan

  • All 6 workflow files + the composite action parse as valid YAML.
  • No new third-party dependencies introduced beyond astral-sh/setup-uv (SHA-pinned to v8.1.0).
  • Needs: org admin to enable GitHub Actions on this repo (see fix(reader): cloudfetch reader nests block_on under enclosing runtime #20 comment thread — GET /repos/.../actions/permissions returns enabled: false today). Without that, none of these workflows fire.

References

This pull request was AI-assisted by Isaac.

gopalldb added 2 commits May 18, 2026 12:27
…ning

Implements the SHA-pinning portion of go/hardened-gha and adopts the
go/pinning-python-deps recommendation (uv lockfile) for the pyo3
sub-crate.

## Composite action: .github/actions/setup-jfrog

Encapsulates the OIDC token exchange + cargo / uv index-URL writes.
Workflows that need crates.io or PyPI access call:

  - uses: ./.github/actions/setup-jfrog
    with:
      cargo: "true"  # write ~/.cargo/config.toml -> db-cargo-remote
      uv: "true"     # export UV_INDEX_URL / PIP_INDEX_URL -> db-pypi

Both pull from databricks.jfrog.io via a GitHub-OIDC-minted access
token. The composite requires `permissions: id-token: write` on the
calling job.

## Workflow updates

  - pr-checks.yml: clippy + test jobs gain cargo proxy (fmt does not
    fetch deps, skipped).
  - coverage.yml: cargo proxy added; cargo-llvm-cov via taiki-e/
    install-action downloads from GitHub Releases (no registry hit).
  - license-check.yml: cargo proxy added for `cargo deny check`.
  - rust-e2e.yml: cargo proxy added; live workspace creds unchanged.
  - pyo3-checks.yml: cargo + uv proxies added. Bootstrap shifts from
    `pip install 'maturin>=...' pytest` to `astral-sh/setup-uv` +
    `uv sync --frozen --group dev` against the committed lockfile.

All five workflows gain `permissions: id-token: write` (some already
had it from prior OIDC integrations).

## Python pinning: pyo3/pyproject.toml + uv.lock

Two-layer pinning per the published-library vs applications/services
split in go/pinning-python-deps:

  - `[project].dependencies` (downstream contract): loose major-
    version-bounded pins. `pyarrow>=14` becomes `pyarrow>=14,<19` to
    cap the major.
  - `[dependency-groups].dev` (PEP 735) lists `maturin>=1.7,<2.0`
    and `pytest>=8.3,<9.0`. uv reads this natively for `uv sync
    --group dev`.

The lockfile (`pyo3/uv.lock`) is NOT in this commit. A reviewer with
JFrog access generates it once via `uv lock` from the pyo3/ dir and
commits it in a follow-up. `pyo3-checks.yml` will hard-fail until
the lockfile lands — that's the gate, not a regression.

## CLAUDE.md

Adds a "Supply-chain hardening" section: SHA-pinning policy (actions,
cargo, Python), how the composite works, how to regenerate the
lockfile, and the open-source caveat (uv records the index URL during
`uv lock`; regenerate against pypi.org locally before committing if
the repo eventually open-sources).

References:
  - go/hardened-gha
    https://docs.google.com/document/d/1zoHgolfZO_IUBIU3w40NmYsoZ9eTRdAmjlfwYOxkj70
  - go/pinning-python-deps
    https://docs.google.com/document/d/1thJsoOBW3NzvRV6pWpujcD8mn4KOXgAW8t10iw6Z6LA
  - go/pypi-registry-access, go/crates-io-registry-access
    https://docs.google.com/document/d/1hnR9y7MJZeRIqyb4ujsNjMzRFKZDZsZ2gWB8DT9XFxc

Co-authored-by: Isaac
Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
Per go/pinning-python-deps, the pyo3 sub-crate is in the
**externally-published-library** scope (the wheel ships to PyPI as
`databricks-sql-kernel`). That section of the doc says:

  Do not add exact version pins for all of your dependencies.
  Doing this makes your library harder for your end users to install.

The committed-lockfile + `uv sync --frozen` approach is for the
**applications/services** scope (Databricks-internal services like
FMAPI, vector search). Wrong scope for the pyo3 wheel.

Revised approach matches the policy verbatim:

  - `[project].dependencies` keeps major-version upper bounds
    (`pyarrow>=14,<19`).
  - `[dependency-groups].dev` keeps the loose `maturin>=1.7,<2.0` and
    `pytest>=8.3,<9.0`.
  - `uv sync --group dev` (no `--frozen`) re-resolves each CI run
    within those bounds.
  - The `db-pypi` proxy's 7-day age filter is the baseline supply-
    chain protection at the registry layer.

No lockfile means no bootstrap step, no open-source-leak caveat, no
maintenance overhead on dep bumps.

Co-authored-by: Isaac
Signed-off-by: Gopal Lal <gopal.lal@databricks.com>

@msrathore-db msrathore-db left a comment

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.

LGTM

@gopalldb
gopalldb merged commit 3e3ff23 into main May 21, 2026
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