ci: embed Rust dep graph in wheels + add SLSA build provenance#211
Merged
Conversation
Wires cargo-auditable into each maturin wheel build so the compiled extension carries its Cargo dep graph (readable by syft / cargo audit bin) — closes the SBOM gap for downstream scanners. Adds attest-build-provenance on every wheel and the sdist for GitHub-side verification via `gh attestation verify`. Closes #210 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
before-script-linux runs before maturin-action installs sccache into the container, but the docker env already carries RUSTC_WRAPPER=sccache from the outer step config. Cargo then fails with "could not execute process sccache". Unset RUSTC_WRAPPER just for the install command so the wrapper kicks in only for the actual maturin build that follows. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
cargo-auditable's dispatch interprets \`cargo-auditable rustc ...\` as rustc-wrapper mode (treating "rustc" as the path to the rustc binary), not as a pass-through to \`cargo rustc\`. That made the CARGO env override break on macos. Upstream's documented fix is a wrapper that injects \`auditable\` as the cargo subcommand (see cargo-auditable#211, REPLACING_CARGO.md). Linux/macOS now create such a wrapper and point CARGO at it. Windows drops cargo-auditable entirely — upstream has no .bat recipe, and the Linux wheels are the ones yente consumes anyway. Windows still gets the attest-build-provenance step. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.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
cargo-auditableinto the Linux and macOS maturin wheel builds so the compiled.socarries its Cargo dep graph —syft/cargo audit bincan now enumerate the embedded Rust crates instead of seeingrigouras a single opaque component. Windows wheels are intentionally skipped (see below).actions/attest-build-provenance@v4on every wheel-matrix shard (incl. Windows) and on the sdist for GitHub-side verification (gh attestation verify, repo Attestations tab).attestations: write,artifact-metadata: write(id-token: writewas already present).The
releasejob is untouched — PEP 740 PyPI attestations should auto-engage via the existing tokenlesspypa/gh-action-pypi-publish@release/v1. To verify on the next tagged release.Closes #210.
Why cargo-auditable needs a wrapper
The naive integration is
CARGO=cargo-auditableon the maturin step. That works forcargo build, but maturin invokescargo rustcfor cdylib builds (it needs precise control over linker args) — andcargo-auditable's dispatch interpretscargo-auditable rustc ...as "rustc-wrapper mode" (treating the literal stringrustcas the path to the rustc binary), not as a pass-through tocargo rustc. The build then fails witherror: Unrecognized option: 'profile'because rustc doesn't accept cargo's--profileflag.This is cargo-auditable#211, closed June 2025. Upstream's documented fix in
REPLACING_CARGO.mdis a wrapper script that injectsauditableas the cargo subcommand:Set
CARGO=/path/to/wrapperon the maturin step and maturin'scargo rustc ...becomescargo auditable rustc ...which is the supported invocation.Implementation notes per platform
before-script-linuxdoesRUSTC_WRAPPER= cargo install cargo-auditable --locked(theRUSTC_WRAPPER=prefix is needed because the outer step config setsRUSTC_WRAPPER=sccachein the container env, but sccache isn't installed in the container until afterbefore-script-linuxruns), then writes the wrapper to/usr/local/bin/cargo-auditable-wrapper.CARGOpoints there.taiki-e/install-action@v2grabs a prebuiltcargo-auditable, a follow-up step writes the wrapper to$RUNNER_TEMP,CARGOpoints there..bat/.cmdrecipe (PRs welcomenotice inREPLACING_CARGO.md), and rigour's Linux wheels are the ones yente actually consumes downstream. Windows wheels still get the GitHub attestation, just not the embedded dep graph. If a Windows consumer ever needs the BOM, we can revisit with a.cmdwrapper.Test plan
wheels-manylinux-x86_64artifact from the PR run, unzip, locaterigour/_core.*.so, and runcargo audit bin <path>— expect the Rust crate graph listedwheels-macos-*artifactcargo audit binreturns "no auditable data found") — this is the intentional gapgh attestation verify <wheel> --owner opensanctionspasses locallypypa/gh-action-pypi-publishtov1.11.0+)syft <venv> -o cyclonedx-jsonnow listspyo3,aho-corasick,icu_*, etc. as components🤖 Generated with Claude Code