From 9161706b7934b48c74625a3c23fe69f4a0c1645a Mon Sep 17 00:00:00 2001 From: John Coffey Date: Thu, 19 Nov 2026 15:54:55 -0700 Subject: [PATCH] List the Rust crates in release SBOMs; check GHCR signatures (K-S7) The first signed release (27.1-rc.33, signed by hand) showed the SBOMs list only the Debian packages in the server image, and nothing but the image itself for Relay, which is built from scratch: syft cannot see the crates in a Rust binary unless the build records them. - Both images build with cargo-auditable 0.7.7, which puts the crate list in the binary, where syft (and Trivy, Grype) read it. - SBOM attestations use actions/attest v4.2.2; actions/attest-sbom is deprecated. - The GHCR copies are verified after signing, as the Gitea ones are. --- .github/workflows/sign.yml | 13 +++++++------ Dockerfile | 7 ++++++- Dockerfile.relay | 6 +++++- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/sign.yml b/.github/workflows/sign.yml index ef9963c6..32e07764 100644 --- a/.github/workflows/sign.yml +++ b/.github/workflows/sign.yml @@ -162,18 +162,19 @@ jobs: run: | set -euo pipefail sign() { echo "signing $1"; cosign sign --yes "$1"; } + SIGNED_GHCR=() sign "$SERVER" [ -z "$RELAY" ] || sign "$RELAY" if [ "$GHCR" = true ]; then # The GHCR copy is the same digest; a version GHCR never got is # skipped, not failed for ref in "$SERVER_GHCR" ${RELAY_GHCR:+"$RELAY_GHCR"}; do - if docker buildx imagetools inspect "$ref" >/dev/null 2>&1; then sign "$ref" + if docker buildx imagetools inspect "$ref" >/dev/null 2>&1; then sign "$ref"; SIGNED_GHCR+=("$ref") else echo "::warning::$ref isn't on GHCR; not signed there"; fi done fi # Check at once, as a user would - for ref in "$SERVER" ${RELAY:+"$RELAY"}; do + for ref in "$SERVER" ${RELAY:+"$RELAY"} ${SIGNED_GHCR[@]+"${SIGNED_GHCR[@]}"}; do cosign verify "$ref" \ --certificate-oidc-issuer https://token.actions.githubusercontent.com \ --certificate-identity-regexp "^https://github.com/$GITHUB_REPOSITORY/\.github/workflows/sign\.yml@refs/(tags/v.+|heads/main)$" \ @@ -200,24 +201,24 @@ jobs: sbom "$RELAY@$R_AMD64" "inbuxa-relay-$VERSION-linux-amd64.spdx.json" sbom "$RELAY@$R_ARM64" "inbuxa-relay-$VERSION-linux-arm64.spdx.json" fi - - uses: actions/attest-sbom@c604332985a26aa8cf1bdc465b92731239ec6b9e # v4.1.0 + - uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2 with: subject-name: ${{ steps.v.outputs.server }} subject-digest: ${{ steps.d.outputs.server_amd64 }} sbom-path: sbom/inbuxa-${{ steps.v.outputs.version }}-linux-amd64.spdx.json - - uses: actions/attest-sbom@c604332985a26aa8cf1bdc465b92731239ec6b9e # v4.1.0 + - uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2 with: subject-name: ${{ steps.v.outputs.server }} subject-digest: ${{ steps.d.outputs.server_arm64 }} sbom-path: sbom/inbuxa-${{ steps.v.outputs.version }}-linux-arm64.spdx.json - if: ${{ steps.d.outputs.relay }} - uses: actions/attest-sbom@c604332985a26aa8cf1bdc465b92731239ec6b9e # v4.1.0 + uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2 with: subject-name: ${{ steps.v.outputs.relay }} subject-digest: ${{ steps.d.outputs.relay_amd64 }} sbom-path: sbom/inbuxa-relay-${{ steps.v.outputs.version }}-linux-amd64.spdx.json - if: ${{ steps.d.outputs.relay }} - uses: actions/attest-sbom@c604332985a26aa8cf1bdc465b92731239ec6b9e # v4.1.0 + uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2 with: subject-name: ${{ steps.v.outputs.relay }} subject-digest: ${{ steps.d.outputs.relay_arm64 }} diff --git a/Dockerfile b/Dockerfile index 8c752a8d..ac4f032a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,11 @@ RUN export DEBIAN_FRONTEND=noninteractive && \ g++-aarch64-linux-gnu binutils-aarch64-linux-gnu \ g++-x86-64-linux-gnu binutils-x86-64-linux-gnu RUN rustup target add "$(cat /target.txt)" +# inbuxa: K-S7: cargo-auditable records the crates in the binary, so the +# SBOM the release workflow makes from this image lists them (not only the +# Debian packages) +ARG CARGO_AUDITABLE_VERSION=0.7.7 +RUN cargo install --locked "cargo-auditable@${CARGO_AUDITABLE_VERSION}" COPY --from=planner /recipe.json /recipe.json # inbuxa: [patch.crates-io] points sieve-rs at vendor/, and the recipe only # carries the workspace's own manifests, so cooking the dependencies needs the @@ -33,7 +38,7 @@ COPY . . # source document. ARG INBUXA_REVISION="" ENV INBUXA_REVISION=${INBUXA_REVISION} -RUN RUSTFLAGS="$(cat /flags.txt)" cargo build --target "$(cat /target.txt)" --release -p inbuxa --no-default-features --features "sqlite postgres mysql rocks s3 redis azure nats" +RUN RUSTFLAGS="$(cat /flags.txt)" cargo auditable build --target "$(cat /target.txt)" --release -p inbuxa --no-default-features --features "sqlite postgres mysql rocks s3 redis azure nats" RUN mv "/build/target/$(cat /target.txt)/release" "/output" # inbuxa: migrations spec, MG-4: the inbuxa-migrate the server runs, a diff --git a/Dockerfile.relay b/Dockerfile.relay index 380fdebe..ce43ea03 100644 --- a/Dockerfile.relay +++ b/Dockerfile.relay @@ -16,9 +16,13 @@ # Docker Hub images, pulled through Google's mirror, as in Dockerfile. FROM mirror.gcr.io/library/rust:1-alpine3.22 AS builder RUN apk add --no-cache musl-dev build-base cmake perl libcap ca-certificates +# The crates go into the binary (cargo-auditable), so the image's SBOM lists +# them: there is nothing else in a scratch image to find +ARG CARGO_AUDITABLE_VERSION=0.7.7 +RUN cargo install --locked "cargo-auditable@${CARGO_AUDITABLE_VERSION}" WORKDIR /build COPY . . -RUN cargo build --release --locked -p inbuxa-relay && \ +RUN cargo auditable build --release --locked -p inbuxa-relay && \ install -m 0755 target/release/inbuxa-relay /inbuxa-relay && \ # Static, or it won't run on a host without musl ! ldd /inbuxa-relay 2>/dev/null | grep -q '=>' && \ -- 2.54.0