From 372e369bf62bc295ebd3f93ad78f235446cd1a33 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 12 Nov 2026 10:10:33 -0500 Subject: [PATCH] ci: lock workflow actions through an actions.lock lockfile Mutable action tags are a supply-chain risk: a moved tag runs different code without a diff. Every workflow action is now pinned through .github/workflows/actions.lock, and CI verifies the lockfile so an out-of-sync or tampered one fails instead of running. --- .github/workflows/actions.lock | 98 ++++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 48 ++++++++--------- .github/workflows/docs.yml | 12 ++--- .github/workflows/lockfile.yml | 34 ++++++++++++ 4 files changed, 162 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/actions.lock create mode 100644 .github/workflows/lockfile.yml diff --git a/.github/workflows/actions.lock b/.github/workflows/actions.lock new file mode 100644 index 00000000..76536773 --- /dev/null +++ b/.github/workflows/actions.lock @@ -0,0 +1,98 @@ +# This file is machine-generated by `gh actions-lock`. +# Do not edit by hand; run `gh actions-lock` to update. +# Docs: https://gh.io/actions-lockfile +version: 'v0.0.3' +workflows: + '.github/workflows/ci.yml': + - 'actions/cache@v5.1.0' + - 'embarkstudios/cargo-deny-action@v2.1.1' + - 'step-security/cache-cargo-install-action@v3.0.8' + - 'step-security/dtolnay-rust-toolchain@v1.0.0' + - 'step-security/harden-runner@v2.22.4' + - 'step-security/taiki-e-install-action@v2.87.32' + - 'taiki-e/checkout-action@v1.4.2' + '.github/workflows/docs.yml': + - 'actions/checkout@v6.1.0' + - 'actions/configure-pages@v6.0.0' + - 'actions/deploy-pages@v5.0.1' + - 'actions/upload-pages-artifact@v4.0.0' + - 'step-security/dtolnay-rust-toolchain@v1.0.0' + - 'step-security/harden-runner@v2.22.4' + '.github/workflows/lockfile.yml': + - 'actions/checkout@v7.0.1' + - 'step-security/harden-runner@v2.22.4' +dependencies: + 'actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9': + ref: 'v6.1.0' + commit: 'sha1-55cc8345863c7cc4c66a329aec7e433d2d1c52a9' + owner_id: 44036562 + repo_id: 215566462 + 'actions/cache@v5.1.0': + ref: 'v5.1.0' + commit: 'sha1-caa296126883cff596d87d8935842f9db880ef25' + owner_id: 44036562 + repo_id: 215566462 + 'actions/checkout@v6.1.0': + ref: 'v6.1.0' + commit: 'sha1-d23441a48e516b6c34aea4fa41551a30e30af803' + owner_id: 44036562 + repo_id: 197814629 + 'actions/checkout@v7.0.1': + ref: 'v7.0.1' + commit: 'sha1-3d3c42e5aac5ba805825da76410c181273ba90b1' + owner_id: 44036562 + repo_id: 197814629 + 'actions/configure-pages@v6.0.0': + ref: 'v6.0.0' + commit: 'sha1-45bfe0192ca1faeb007ade9deae92b16b8254a0d' + owner_id: 44036562 + repo_id: 513659658 + 'actions/deploy-pages@v5.0.1': + ref: 'v5.0.1' + commit: 'sha1-368f82528645a54fb793d4d04e342629a3f51346' + owner_id: 44036562 + repo_id: 438112499 + 'actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02': + ref: 'v4.6.2' + commit: 'sha1-ea165f8d65b6e75b540449e92b4886f43607fa02' + owner_id: 44036562 + repo_id: 192625955 + 'actions/upload-pages-artifact@v4.0.0': + ref: 'v4.0.0' + commit: 'sha1-7b1f4a764d45c48632c6b24a0339c27f5614fb0b' + owner_id: 44036562 + repo_id: 496012378 + uses: + - 'actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02' + 'embarkstudios/cargo-deny-action@v2.1.1': + ref: 'v2.1.1' + commit: 'sha1-3c6349835b2b7b196a839186cb8b78e02f7b5f25' + owner_id: 44887257 + repo_id: 228054692 + 'step-security/cache-cargo-install-action@v3.0.8': + ref: 'v3.0.8' + commit: 'sha1-8710a7398ec4810e2dc6ab750c864efc91818376' + owner_id: 88700172 + repo_id: 1408359637 + uses: + - 'actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9' + 'step-security/dtolnay-rust-toolchain@v1.0.0': + ref: 'v1.0.0' + commit: 'sha1-8dd607977d06adf4ed49b190381e74c17a9dd25f' + owner_id: 88700172 + repo_id: 1249865941 + 'step-security/harden-runner@v2.22.4': + ref: 'v2.22.4' + commit: 'sha1-1d88384fd173af6ecb012dfd0264a306b711241a' + owner_id: 88700172 + repo_id: 422287306 + 'step-security/taiki-e-install-action@v2.87.32': + ref: 'v2.87.32' + commit: 'sha1-76747d22a7567cc4438546a84f11bdf18e670ab8' + owner_id: 88700172 + repo_id: 1382753260 + 'taiki-e/checkout-action@v1.4.2': + ref: 'v1.4.2' + commit: 'sha1-7d1e50e93dc4fb3bba58f85018fadf77898aee8b' + owner_id: 43724913 + repo_id: 769249267 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0135a899..17a6e0e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,11 +11,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden runner - uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 + uses: step-security/harden-runner@v2.22.4 with: egress-policy: audit - - uses: taiki-e/checkout-action@v1 - - uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0 + - uses: taiki-e/checkout-action@v1.4.2 + - uses: step-security/dtolnay-rust-toolchain@v1.0.0 with: toolchain: nightly components: rustfmt @@ -27,13 +27,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden runner - uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 + uses: step-security/harden-runner@v2.22.4 with: egress-policy: audit - name: Checkout - uses: taiki-e/checkout-action@v1 + uses: taiki-e/checkout-action@v1.4.2 - name: Install Taplo - uses: step-security/taiki-e-install-action@76747d22a7567cc4438546a84f11bdf18e670ab8 # v2.87.32 + uses: step-security/taiki-e-install-action@v2.87.32 with: tool: taplo-cli - name: Run Taplo @@ -45,11 +45,11 @@ jobs: timeout-minutes: 30 steps: - name: Harden runner - uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 + uses: step-security/harden-runner@v2.22.4 with: egress-policy: audit - - uses: taiki-e/checkout-action@v1 - - uses: step-security/taiki-e-install-action@76747d22a7567cc4438546a84f11bdf18e670ab8 # v2.87.32 + - uses: taiki-e/checkout-action@v1.4.2 + - uses: step-security/taiki-e-install-action@v2.87.32 with: tool: typos-cli - name: run typos @@ -132,17 +132,17 @@ jobs: steps: - name: Harden runner - uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 + uses: step-security/harden-runner@v2.22.4 with: egress-policy: audit - - uses: taiki-e/checkout-action@v1 + - uses: taiki-e/checkout-action@v1.4.2 - name: Restore cache of cargo folder # We use `restore` and later `save`, so that we can create the key after # the cache has been downloaded. # # This could be avoided if we added Cargo.lock to the repository. - uses: actions/cache/restore@v5 + uses: actions/cache/restore@v5.1.0 with: # https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci path: | @@ -163,13 +163,13 @@ jobs: - name: Cache cargo-apk if: contains(matrix.platform.target, 'android') id: cargo-apk-cache - uses: actions/cache@v5 + uses: actions/cache@v5.1.0 with: path: ~/.cargo/bin/cargo-apk # Change this key if we update the required cargo-apk version key: cargo-apk-v0-9-7 - - uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0 + - uses: step-security/dtolnay-rust-toolchain@v1.0.0 if: contains(matrix.platform.target, 'android') && (steps.cargo-apk-cache.outputs.cache-hit != 'true') with: toolchain: stable @@ -178,12 +178,12 @@ jobs: if: contains(matrix.platform.target, 'android') && (steps.cargo-apk-cache.outputs.cache-hit != 'true') run: cargo install cargo-apk --version=^0.9.7 --locked - - uses: step-security/cache-cargo-install-action@8710a7398ec4810e2dc6ab750c864efc91818376 # v3.0.8 + - uses: step-security/cache-cargo-install-action@v3.0.8 if: contains(matrix.platform.target, 'wasm32') && matrix.toolchain == 'nightly' with: tool: wasm-bindgen-cli - - uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0 + - uses: step-security/dtolnay-rust-toolchain@v1.0.0 if: matrix.platform.host == '' with: toolchain: ${{ matrix.toolchain }} @@ -315,7 +315,7 @@ jobs: # See restore step above - name: Save cache of cargo folder - uses: actions/cache/save@v5 + uses: actions/cache/save@v5.1.0 with: path: | ~/.cargo/registry/index/ @@ -329,11 +329,11 @@ jobs: steps: - name: Harden runner - uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 + uses: step-security/harden-runner@v2.22.4 with: egress-policy: audit - - uses: taiki-e/checkout-action@v1 - - uses: EmbarkStudios/cargo-deny-action@v2 + - uses: taiki-e/checkout-action@v1.4.2 + - uses: EmbarkStudios/cargo-deny-action@v2.1.1 with: log-level: error @@ -347,10 +347,10 @@ jobs: steps: - name: Harden runner - uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 + uses: step-security/harden-runner@v2.22.4 with: egress-policy: audit - - uses: taiki-e/checkout-action@v1 + - uses: taiki-e/checkout-action@v1.4.2 - name: Setup NPM run: npm install - name: Run ESLint @@ -366,10 +366,10 @@ jobs: steps: - name: Harden runner - uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 + uses: step-security/harden-runner@v2.22.4 with: egress-policy: audit - - uses: taiki-e/checkout-action@v1 + - uses: taiki-e/checkout-action@v1.4.2 - name: Install SWC run: sudo npm i -g @swc/cli - name: Run SWC diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 80528bd9..da58f106 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -20,12 +20,12 @@ jobs: steps: - name: Harden runner - uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 + uses: step-security/harden-runner@v2.22.4 with: egress-policy: audit - - uses: actions/checkout@v6 + - uses: actions/checkout@v6.1.0 - - uses: step-security/dtolnay-rust-toolchain@8dd607977d06adf4ed49b190381e74c17a9dd25f # v1.0.0 + - uses: step-security/dtolnay-rust-toolchain@v1.0.0 with: toolchain: nightly @@ -36,7 +36,7 @@ jobs: cargo doc --no-deps -Z rustdoc-map -Z rustdoc-scrape-examples --features=serde,mint,android-native-activity - name: Setup Pages - uses: actions/configure-pages@v6 + uses: actions/configure-pages@v6.0.0 - name: Fix permissions run: | @@ -45,10 +45,10 @@ jobs: done - name: Upload artifact - uses: actions/upload-pages-artifact@v4 + uses: actions/upload-pages-artifact@v4.0.0 with: path: target/doc - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v5 + uses: actions/deploy-pages@v5.0.1 diff --git a/.github/workflows/lockfile.yml b/.github/workflows/lockfile.yml new file mode 100644 index 00000000..5d880602 --- /dev/null +++ b/.github/workflows/lockfile.yml @@ -0,0 +1,34 @@ +name: Lockfile + +# Fails when .github/workflows/actions.lock is out of sync with the workflows, or when a locked pin +# no longer verifies upstream, so a moved tag cannot slip a different commit into a run. +# Docs: https://gh.io/actions-lockfile +on: + pull_request: + push: + branches: [master] + workflow_dispatch: + +permissions: + contents: read + +env: + GH_TOKEN: ${{ github.token }} + +jobs: + lockfile: + name: Lockfile is in sync + runs-on: ubuntu-24.04 + timeout-minutes: 10 + steps: + - name: Harden runner + uses: step-security/harden-runner@v2.22.4 + with: + egress-policy: audit + - uses: actions/checkout@v7.0.1 + with: + persist-credentials: false + - name: Install gh-actions-lock + run: gh extension install github/gh-actions-lock --pin v0.4.1 + - name: Verify the lockfile + run: gh actions-lock --verify