Skip to content
Merged
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 .github/workflows/pyo3-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,14 @@ jobs:
# The pyo3 crate's Rust-side unit tests cover the GIL handoff
# in isolation. Runs before any maturin build so a pure-Rust
# break is caught fast.
run: cargo test -p databricks-sql-kernel-pyo3
#
# pyo3 is a standalone workspace (see `pyo3/Cargo.toml`), so
# `cargo test` runs from inside `pyo3/` rather than via
# `-p` from the kernel root. Same reason as napi: per-binding
# TLS feature choice cannot share a workspace with the kernel
# default.
working-directory: pyo3
run: cargo test

- name: "Build + install pyo3 wheel (maturin develop)"
working-directory: pyo3
Expand Down
64 changes: 45 additions & 19 deletions .github/workflows/securityScan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,29 @@ name: Security Scan
#
# Scanner: OSV-Scanner v2.3.8 (purl-based via OSV.dev; federates
# GHSA, NVD, RustSec, PyPA, Go vuln DB). Reads CycloneDX SBOMs
# produced by `cargo cyclonedx` over the kernel's two workspaces:
# produced by `cargo cyclonedx` over the kernel's three standalone
# workspaces:
#
# 1. Root workspace `[".", "pyo3"]` — emits two SBOMs (one per
# member: databricks-sql-kernel + databricks-sql-kernel-pyo3).
# 2. napi/ standalone workspace — emits its own SBOM.
# 1. Kernel root `Cargo.toml` (members = ["."]) — emits one SBOM
# for `databricks-sql-kernel`.
# 2. pyo3/ standalone workspace — emits one SBOM for
# `databricks-sql-kernel-pyo3` (built with `tls-rustls`).
# 3. napi/ standalone workspace — emits one SBOM for
# `databricks-sql-kernel-napi` (also `tls-rustls`).
#
# The bindings are deliberately NOT members of the kernel's root
# workspace because their kernel-dep features (`tls-rustls`) conflict
# with the kernel's default (`tls-native`); Cargo would unify the
# feature set across workspace members and trip the mutual-exclusion
# `compile_error!` in `src/lib.rs`. See the workspace comment in
# each Cargo.toml.
#
# We deliberately do NOT pass --override-filename, because that
# causes a same-name collision when a workspace has multiple members
# (one SBOM per member is written to the same path, last-writer
# wins). Letting cyclonedx pick per-package names + globbing keeps
# every workspace member in scope.
# caused a same-name collision back when the root workspace had
# multiple members (one SBOM per member written to the same path,
# last-writer wins). Letting cyclonedx pick per-package names +
# globbing keeps every workspace in scope as the workspace shape
# evolves.
#
# Coverage caveat: the pyo3 SBOM is Rust-only — it does NOT include
# Python-side runtime deps (pyarrow, etc.) that maturin resolves at
Expand Down Expand Up @@ -91,10 +103,11 @@ jobs:

# Two cyclonedx invocations cover all three published artifacts:
#
# - From repo root: writes one SBOM per root-workspace member.
# Members are [".", "pyo3"], so we get
# databricks-sql-kernel.cdx.json AND
# databricks-sql-kernel-pyo3.cdx.json.
# - From repo root: writes one SBOM (kernel root is now a
# single-member workspace) — databricks-sql-kernel.cdx.json.
#
# - From pyo3/: standalone workspace, writes one SBOM
# (databricks-sql-kernel-pyo3.cdx.json).
#
# - From napi/: standalone workspace, writes one SBOM
# (databricks-sql-kernel-napi.cdx.json).
Expand All @@ -108,15 +121,28 @@ jobs:
set -euo pipefail
mkdir -p /tmp/sboms

# Root workspace has members [".", "pyo3"]; cargo-cyclonedx
# writes one SBOM per member alongside its Cargo.toml. Pull
# them in by EXPLICIT path (./*.cdx.json and pyo3/*.cdx.json)
# rather than a **/*.cdx.json globstar walk — the walk would
# silently pick up a stray .cdx.json under target/ or a test
# The kernel root, pyo3, and napi are each their own
# standalone single-member workspaces (see the workspace
# comment in each Cargo.toml — pyo3 and napi need
# `tls-rustls` while the kernel default is `tls-native`,
# and Cargo feature unification across a shared workspace
# would trip the mutual-exclusion `compile_error!` in
# `src/lib.rs`). So `cargo cyclonedx` has to be invoked
# once per workspace.
#
# Pull SBOMs in by EXPLICIT path rather than a
# `**/*.cdx.json` globstar walk — the walk would silently
# pick up a stray .cdx.json under target/ or a test
# fixture if one ever lands.
cargo cyclonedx --format json
shopt -s nullglob
for f in ./*.cdx.json pyo3/*.cdx.json; do

cargo cyclonedx --format json
for f in ./*.cdx.json; do
cp "$f" "/tmp/sboms/$(basename "$f")"
done

( cd pyo3 && cargo cyclonedx --format json )
for f in pyo3/*.cdx.json; do
cp "$f" "/tmp/sboms/$(basename "$f")"
done

Expand Down
148 changes: 0 additions & 148 deletions Cargo.lock

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

20 changes: 12 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,17 @@ tls-rustls = ["reqwest/rustls-tls"]
name = "databricks_sql_kernel"
crate-type = ["lib", "cdylib", "staticlib"]

# Workspace — the kernel is the root crate; pyo3 is a sibling member.
# Workspace — the kernel is its own single-member workspace root.
#
# The napi binding crate (`napi/`) is deliberately NOT a member: it
# uses `tls-rustls` while pyo3 uses the default `tls-native`, and a
# single-workspace build would unify both kernel features and link
# both TLS stacks (defeating the rustls switch — see [features]
# comment above). napi declares its own `[workspace]` at `napi/Cargo.toml`
# and reaches the kernel via `path = ".."`.
# Neither `pyo3/` nor `napi/` is a member: both bindings opt INTO
# `tls-rustls` (see the `[features]` comment above for why), while
# the kernel itself defaults to `tls-native` for direct-Rust / C-ABI
# consumers. A single-workspace build would unify the kernel's
# feature set to `tls-native ∪ tls-rustls` across all members,
# trip the mutual-exclusion `compile_error!` in `src/lib.rs`, and
# defeat the per-binding TLS choice. Each binding therefore declares
# its own `[workspace]` (see `pyo3/Cargo.toml` and `napi/Cargo.toml`)
# and reaches the kernel via `path = ".."` — same source tree, three
# workspace views (kernel root, pyo3, napi).
[workspace]
members = [".", "pyo3"]
members = ["."]
Loading
Loading