Repository navigation
chore(ci): route registry traffic through JFrog + uv-based Python pinning - #31
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-jfrogEncapsulates the OIDC token exchange + cargo / uv index-URL writes. Workflows that need crates.io or PyPI access call:
Both pull from
databricks.jfrog.iovia a GitHub-OIDC-minted access token. The composite requirespermissions: id-token: writeon the calling job.Workflow updates
pr-checks.ymlcoverage.ymlcargo-llvm-covviataiki-e/install-actiondownloads from GitHub Releases (no registry hit)license-check.ymlcargo deny checkrust-e2e.ymlpyo3-checks.ymlpip install 'maturin>=...' pytesttoastral-sh/setup-uv+uv sync --group devAll five workflows gain
permissions: id-token: write(some already had it from prior OIDC integrations).Python pinning —
pyo3/pyproject.tomlThe pyo3 wheel ships externally as
databricks-sql-kernel. Per the externally-published-library section ofgo/pinning-python-deps:So:
[project].dependenciesgains a major-version upper bound:pyarrow>=14→pyarrow>=14,<19.[dependency-groups].dev(PEP 735) listsmaturin>=1.7,<2.0andpytest>=8.3,<9.0. uv reads this natively foruv sync --group dev.uv.lockcommitted, no--frozenflag in CI. uv re-resolves each run within the major-version bounds.The
db-pypiproxy's 7-day age filter is the baseline supply-chain protection at the registry layer.CLAUDE.md
Adds a "Supply-chain hardening" section documenting:
Test plan
astral-sh/setup-uv(SHA-pinned to v8.1.0).GET /repos/.../actions/permissionsreturnsenabled: falsetoday). Without that, none of these workflows fire.References
This pull request was AI-assisted by Isaac.