Build release binaries with cargo auditable to embed dependency data - #937
Build release binaries with cargo auditable to embed dependency data#937shashial wants to merge 6 commits into
Conversation
|
Claude finished @shashial's task in 3m 37s —— View job Review: cargo auditable release buildsReviewed the diff against Blocking-ish1. 2. The Worth addressing3. No verification that 4. Reproducible builds not re-verified — 5. Version pinned in four independent places — 6. README sections now conflict — the "Reproducible builds" section (lines 157–176) still instructs plain Minor
Not run: |
There was a problem hiding this comment.
Pull request overview
This PR updates the release build pipeline to run through cargo auditable so produced binaries embed a resolved dependency list (enabling downstream vulnerability/dep scanning), and adds a Makefile target to scan built binaries with cargo audit bin.
Changes:
- Switch release-oriented
make build*targets tocargo auditable buildand add helper install targets forcargo-auditable/cargo-audit. - Update Docker build paths and the macOS release workflow path to build via
cargo auditable. - Document auditable builds and add a
make audit-bintarget for RustSec scanning of built binaries.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Adds documentation for auditable release builds and make audit-bin. |
| Makefile | Routes release builds through cargo auditable and introduces audit-bin scanning. |
| docker/Dockerfile.reproducible | Installs cargo-auditable so reproducible Docker builds embed audit data. |
| docker/Dockerfile.rbuilder | Installs cargo-auditable and builds packages via cargo auditable. |
| .github/workflows/release.yaml | Installs cargo-auditable on macOS and builds macOS release binaries via cargo auditable. |
Suppressed comments (1)
Makefile:161
install-cargo-auditpins 0.22.2 in the install command, but thecommand -vguard means any preinstalledcargo-auditversion will be used (which may not behave consistently across environments). Consider checking the installed version and reinstalling when it differs.
@command -v cargo-audit >/dev/null 2>&1 || cargo install cargo-audit@0.22.2 --locked
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Claude finished @shashial's task in 4m 23s —— View job Re-review: cargo auditable release builds
Prior round's findings are mostly addressed: Worth addressing1. Linux release artifacts are only partially verified — 2. Reproducibility still isn't verified for this change. Related: 3. Version pinned in four places — 4. Mac verify step can't be exercised before a release — Rust changes (clippy commit)5. Over-broad allow —
Minor
Not run: |
|
Claude finished @shashial's task in 4m 45s —— View job Re-review: cargo auditable release builds
Round-2 findings are addressed: Worth addressing1. 2. Empty version from 3. 4. Reproducibility still isn't verified for this change — carried from round 2, still the highest-stakes open item. 5. README overstates the release build — Minor
Checked and fine: Not run: |
|
Claude finished @shashial's task in 4m 54s —— View job Re-review: cargo auditable release builds
Round-3 findings are addressed: Two things changed in Worth addressing1. Mac 2. 3. Version guard checks the wrong thing — 4. Reproducibility still isn't verified for this change — carried from rounds 2 and 3. 5. README reproducible section still contradicts the release image — Minor
Rust changes
Checked and fine: Not run: |
| `make build` produces reproducible binaries on x86_64: it sets the `SOURCE_DATE_EPOCH` | ||
| environment variable (last commit timestamp) and the required compiler flags automatically: |
There was a problem hiding this comment.
Still unaddressed from the last round: "sets SOURCE_DATE_EPOCH (last commit timestamp)" is true for a local make build (Makefile:54, SOURCE_DATE ?= $(shell git log -1 --pretty=%ct)), but docker/Dockerfile.reproducible:19 builds the published Linux artifacts with SOURCE_DATE=1730000000. Following these instructions on a release commit gives you two matching hashes that don't match the released binary — which is the same trap the old section had, just relocated.
| `make build` produces reproducible binaries on x86_64: it sets the `SOURCE_DATE_EPOCH` | |
| environment variable (last commit timestamp) and the required compiler flags automatically: | |
| `make build` produces reproducible binaries on x86_64: it sets the `SOURCE_DATE_EPOCH` | |
| environment variable (last commit timestamp) and the required compiler flags automatically. | |
| Note that the released Linux binaries are built by `docker/Dockerfile.reproducible`, which pins | |
| `SOURCE_DATE_EPOCH` to a fixed value, so their hashes will not match a local `make build`: |
Also, SOURCE_DATE comes from git log -1, so this only works from a checkout with history — in a shallow/tarball checkout it expands to empty and SOURCE_DATE_EPOCH= is silently unset, producing a non-reproducible build with no warning.
| FEATURE_FLAG="--features $FEATURES" | ||
| fi | ||
| cargo build --profile ${{ matrix.profile }} $FEATURE_FLAG \ | ||
| cargo auditable build --locked --profile ${{ matrix.profile }} $FEATURE_FLAG \ |
There was a problem hiding this comment.
The Verify audit data embedded (Mac) step that followed this build in the previous commit was dropped in fix review, so the Mac release artifacts are now the only build path in this PR with no .dep-v0 assertion — docker/Dockerfile.rbuilder:80 and docker/Dockerfile.reproducible:20 both check, this doesn't.
That's the wrong path to drop it from. The two Docker checks exercise ELF section emission; Mach-O is the one object format nothing here covers. If cargo auditable silently no-ops on darwin — linker dropping the __DATA,.dep-v0 section, a toolchain change, a bad cargo install — six darwin release binaries ship without embedded data and the release is green.
If it was removed because it can only ever fail during a real release, cargo audit bin is the better version of the check: it errors on a binary with no embedded data rather than grepping a tool-specific section rendering, and it doubles as the vulnerability scan. Otherwise, re-add the otool -l step and confirm it once with a workflow_dispatch run (build-mac: true, draft-release: false) before merging.
| --mount=type=cache,target=/usr/local/cargo/git \ | ||
| --mount=type=cache,target=$SCCACHE_DIR,sharing=locked \ | ||
| cargo build --release --features="$FEATURES" --package=${RBUILDER_BIN} | ||
| cargo auditable build --release --features="$FEATURES" --package=${RBUILDER_BIN} |
There was a problem hiding this comment.
The .dep-v0 check below settles the correctness question from the last round — good. Remaining concern here is build time, not correctness.
This stage has RUSTC_WRAPPER=sccache (line 47) and cargo auditable sets RUSTC_WORKSPACE_WRAPPER, so workspace crates are now compiled through a chained wrapper rather than sccache rustc directly. Dependencies from cargo chef cook (line 70) still go through plain sccache and cache normally, but the workspace crates are the slow part of an incremental image rebuild. Worth reading the sccache --show-stats / compile-request counts off one build log to confirm hit rate didn't collapse — I haven't verified the chaining semantics, only that the two wrappers are now both set.
Minor: line 39 leaves /tmp/cargo-auditable-version in the base stage, inherited by every stage built from it. --mount=type=bind,source=.cargo-auditable-version,target=/tmp/v avoids the layer.
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
|
Claude finished @shashial's task in 2m 41s —— View job Re-review: cargo auditable release builds
Correction to my last roundThe Still open1. Mac 2. PR description is now stale. 3. Reproducibility still isn't verified for this change — rounds 2, 3, 4, now 5. 4. README reproducible section still contradicts the release image — Minor
Checked and fine
Not run: |
📝 Summary
Release builds now go through
cargo auditable,which embeds the resolved dependency list into a
.dep-v0section of each binary.make build*targets,docker/Dockerfile.rbuilder,docker/Dockerfile.reproducible, and theMac path of the release workflow build with
cargo auditable buildcargo-auditableis pinned to0.7.5in all build paths so every artifact embeds identicallyformatted data
build-dev, CI test builds) are unchanged💡 Motivation and Context
Makes binaries — and container images built from them — scannable for Rust dependencies and known
vulnerabilities with
cargo audit bin, trivy, grype, syft, etc.✅ I have completed the following steps:
make lintmake test