From 2edc87fd715a502230c9cfde4ced93def56b025e Mon Sep 17 00:00:00 2001 From: jadamcrain Date: Wed, 28 Oct 2026 10:31:33 -0700 Subject: [PATCH 1/3] Audit the workflows with zizmor --- .github/workflows/ci.yml | 1 + .github/workflows/security-audit.yml | 28 ++++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9eb3167a..6bd31b6a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -813,6 +813,7 @@ jobs: cd conformance-results zip -r ../release/conformance-results.zip . - name: Create GitHub release + # zizmor: ignore[superfluous-actions] until this step moves to the gh CLI uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3 with: draft: true diff --git a/.github/workflows/security-audit.yml b/.github/workflows/security-audit.yml index 87cf93e9..2f5e85b6 100644 --- a/.github/workflows/security-audit.yml +++ b/.github/workflows/security-audit.yml @@ -15,20 +15,44 @@ on: paths: - '**/Cargo.toml' - '**/Cargo.lock' - - '.github/workflows/security-audit.yml' + - '.github/workflows/**' + - '.github/dependabot.yml' - '.cargo/audit.toml' # Run on PRs to test before merging. The job binstalls cargo-audit and reads # Cargo.lock, so it's cheap enough to run unfiltered - and an unfiltered # trigger is a prerequisite for ever making this a required status check, # since a path-filtered workflow reports no status at all. pull_request: - # audit and osv-scanner are required checks, so they must also run in the merge queue + # audit, osv-scanner and zizmor are required checks, so they must also run in the merge queue merge_group: permissions: contents: read jobs: + # Static analysis of the workflows themselves: unpinned or known-vulnerable actions, expression + # injection, credential persistence and cache poisoning. Inline ignore comments record the + # accepted findings. + zizmor: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Install cargo-binstall + uses: cargo-bins/cargo-binstall@e00d2c94cc0067b77737821097a62d91c0301baa # v1.21.1 + + - name: Install zizmor + run: cargo binstall zizmor@1.31.1 --no-confirm + + - name: Audit the workflows + env: + # the online audits check each pinned commit and look up advisories against the actions + GH_TOKEN: ${{ github.token }} + run: zizmor --format github .github + audit: runs-on: ubuntu-latest steps: From aae4427a297310eea2f4d30490808e29cc43f26f Mon Sep 17 00:00:00 2001 From: jadamcrain Date: Wed, 28 Oct 2026 10:42:17 -0700 Subject: [PATCH 2/3] Build the CI tools from crates.io at pinned versions --- .github/actions/cargo-tool/action.yml | 31 +++++++++++++++++++++++++++ .github/dependabot.yml | 5 ++++- .github/workflows/ci.yml | 8 +++---- .github/workflows/security-audit.yml | 23 ++++++++++---------- 4 files changed, 51 insertions(+), 16 deletions(-) create mode 100644 .github/actions/cargo-tool/action.yml diff --git a/.github/actions/cargo-tool/action.yml b/.github/actions/cargo-tool/action.yml new file mode 100644 index 00000000..e303dfef --- /dev/null +++ b/.github/actions/cargo-tool/action.yml @@ -0,0 +1,31 @@ +name: Install a cargo tool +description: Builds a tool from crates.io at a pinned version with its lockfile, caching the binary +inputs: + crate: + description: The crate, whose binary has the same name + required: true + version: + description: The exact version + required: true +runs: + using: composite + steps: + - name: Name the runner image + id: image + shell: bash + run: echo "image=${ImageOS:-$RUNNER_OS}-$RUNNER_ARCH" >> "$GITHUB_OUTPUT" + # The key names the exact version and has no restore-keys, so a hit is always this build. A PR + # run saves only to its own ref, which no other run restores from + - name: Restore the binary + id: cache + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ~/.cargo/bin/${{ inputs.crate }} + key: cargo-tool-${{ inputs.crate }}-${{ inputs.version }}-${{ steps.image.outputs.image }} + - name: Build it + if: steps.cache.outputs.cache-hit != 'true' + shell: bash + env: + CRATE: ${{ inputs.crate }} + VERSION: ${{ inputs.version }} + run: cargo install --locked "$CRATE" --version "$VERSION" diff --git a/.github/dependabot.yml b/.github/dependabot.yml index a484c867..7ef1fd5f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,7 +3,10 @@ version: 2 updates: - package-ecosystem: github-actions - directory: / + # the workflows, and the composite actions they call + directories: + - / + - /.github/actions/* schedule: interval: monthly # wait a week after a release before proposing it diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6bd31b6a..0c818546 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -147,12 +147,12 @@ jobs: - name: Install Rust from rust-toolchain.toml if: github.event_name == 'pull_request' || github.event_name == 'merge_group' run: rustup toolchain install - - name: Install cargo-binstall - if: github.event_name == 'pull_request' || github.event_name == 'merge_group' - uses: cargo-bins/cargo-binstall@8a2045612414e945291083f820cd50b4d8fc2218 # v1.26.0 - name: Install cargo-semver-checks if: github.event_name == 'pull_request' || github.event_name == 'merge_group' - run: cargo binstall cargo-semver-checks@0.51.0 --no-confirm + uses: $/.github/actions/cargo-tool + with: + crate: cargo-semver-checks + version: 0.51.0 - name: Compare the public API with the base revision if: github.event_name == 'pull_request' || github.event_name == 'merge_group' uses: obi1kenobi/cargo-semver-checks-action@6b69fcf40e9b5fb17adeb57e4b6ecd020649a239 # v2.9 diff --git a/.github/workflows/security-audit.yml b/.github/workflows/security-audit.yml index 2f5e85b6..1d5658dd 100644 --- a/.github/workflows/security-audit.yml +++ b/.github/workflows/security-audit.yml @@ -16,10 +16,11 @@ on: - '**/Cargo.toml' - '**/Cargo.lock' - '.github/workflows/**' + - '.github/actions/**' - '.github/dependabot.yml' - '.cargo/audit.toml' - # Run on PRs to test before merging. The job binstalls cargo-audit and reads - # Cargo.lock, so it's cheap enough to run unfiltered - and an unfiltered + # Run on PRs to test before merging. The job reads Cargo.lock with a cached + # cargo-audit, so it's cheap enough to run unfiltered - and an unfiltered # trigger is a prerequisite for ever making this a required status check, # since a path-filtered workflow reports no status at all. pull_request: @@ -41,11 +42,11 @@ jobs: with: persist-credentials: false - - name: Install cargo-binstall - uses: cargo-bins/cargo-binstall@e00d2c94cc0067b77737821097a62d91c0301baa # v1.21.1 - - name: Install zizmor - run: cargo binstall zizmor@1.31.1 --no-confirm + uses: $/.github/actions/cargo-tool + with: + crate: zizmor + version: 1.31.1 - name: Audit the workflows env: @@ -61,11 +62,11 @@ jobs: with: persist-credentials: false - - name: Install cargo-binstall - uses: cargo-bins/cargo-binstall@8a2045612414e945291083f820cd50b4d8fc2218 # v1.26.0 - - - name: Install cargo-audit binary (fast) - run: cargo binstall cargo-audit@0.22.1 --no-confirm + - name: Install cargo-audit + uses: $/.github/actions/cargo-tool + with: + crate: cargo-audit + version: 0.22.1 # Run cargo-audit exactly once. The exit status alone can't distinguish # "vulnerabilities found" from "the tool or advisory DB fetch failed", so From 7c6222185d915f8b0ddb894fd3d52c3f1e5988e5 Mon Sep 17 00:00:00 2001 From: jadamcrain Date: Wed, 28 Oct 2026 11:02:59 -0700 Subject: [PATCH 3/3] Bump the CI tools with the toolchain --- RELEASE.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/RELEASE.md b/RELEASE.md index 1c3fb972..10a06121 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -85,6 +85,10 @@ still pass (raise the pinned `cargo-semver-checks` with it if rustdoc's JSON format changed). Raise it out of cycle only for a confirmed miscompilation or a rustc security fix. The `msrv` job checks the declared `rust-version` separately. +CI builds `cargo-audit`, `cargo-semver-checks` and `zizmor` from crates.io at the +versions its workflows name, which Dependabot doesn't update. Raise them to +their latest releases at the same time. + ## CHANGELOG conventions - The upcoming release has one section, headed by its final version (`### X.Y.Z ###`), from the