From a02865a1aa6eebcc9badbf97aeb4249b8886bcc3 Mon Sep 17 00:00:00 2001 From: ARUNAVO RAY Date: Tue, 19 May 2026 12:44:23 +0530 Subject: [PATCH] ci: pin third-party GitHub Actions to commit SHAs (#293) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tags are mutable. A compromised maintainer (or a maintainer's compromised machine) can force-move v-tags to point at malicious commits, and any workflow using `@vN` picks up the malicious code on its next run — see the recent `actions-cool/issues-helper` / `maintain-one-comment` incident exfiltrating credentials from `Runner.Worker` memory. This commit pins every third-party action in the two workflows that handle secrets (GHCR push, Docker Hub login, Scout token) to immutable 40-char SHAs, with a trailing comment naming the release version for readability. SHAs are the latest released tag at time of pin. The two DeterminateSystems actions were on `@main` — a *branch* ref that moves on every push, materially worse than a tag — and are now pinned to the latest release SHAs (v22 / v13). First-party `actions/*` and `github/codeql-action` are left on tags for now; they're a separate, lower-risk follow-up. --- .github/workflows/docker-build.yml | 18 +++++++++--------- .github/workflows/nix-build.yml | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 06a4f95..e044747 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -51,13 +51,13 @@ jobs: ref: ${{ env.SHA }} - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 with: driver-opts: network=host - name: Log into registry if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository - uses: docker/login-action@v3 + uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -66,7 +66,7 @@ jobs: # Login to Docker Hub for Docker Scout (optional - provides better vulnerability data) # Add DOCKERHUB_USERNAME and DOCKERHUB_TOKEN secrets to enable this - name: Log into Docker Hub - uses: docker/login-action@v3 + uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 continue-on-error: true with: username: ${{ secrets.DOCKERHUB_USERNAME }} @@ -108,7 +108,7 @@ jobs: # Extract metadata for Docker - name: Extract Docker metadata id: meta - uses: docker/metadata-action@v5 + uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE }} labels: | @@ -124,7 +124,7 @@ jobs: # Build and push Docker image - name: Build and push Docker image id: build-and-push - uses: docker/build-push-action@v6 + uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 with: context: . platforms: linux/amd64,linux/arm64 @@ -139,7 +139,7 @@ jobs: # Load image locally for security scanning (PRs only) - name: Load image for scanning if: github.event_name == 'pull_request' - uses: docker/build-push-action@v6 + uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 with: context: . platforms: linux/amd64 @@ -212,7 +212,7 @@ jobs: # Docker Scout comprehensive security analysis - name: Docker Scout - Vulnerability Analysis & Recommendations - uses: docker/scout-action@v1 + uses: docker/scout-action@bacf462e8d090c09660de30a6ccc718035f961e3 # v1.20.4 if: github.event_name != 'pull_request' with: command: cves,recommendations @@ -226,7 +226,7 @@ jobs: # Docker Scout for Pull Requests (using local image) - name: Docker Scout - Vulnerability Analysis (PR) - uses: docker/scout-action@v1 + uses: docker/scout-action@bacf462e8d090c09660de30a6ccc718035f961e3 # v1.20.4 if: github.event_name == 'pull_request' with: command: cves,recommendations @@ -240,7 +240,7 @@ jobs: # Compare to latest for PRs and pushes - name: Docker Scout - Compare to Latest - uses: docker/scout-action@v1 + uses: docker/scout-action@bacf462e8d090c09660de30a6ccc718035f961e3 # v1.20.4 if: github.event_name == 'pull_request' with: command: compare diff --git a/.github/workflows/nix-build.yml b/.github/workflows/nix-build.yml index 8c246b2..4e630b6 100644 --- a/.github/workflows/nix-build.yml +++ b/.github/workflows/nix-build.yml @@ -38,10 +38,10 @@ jobs: - uses: actions/checkout@v4 - name: Install Nix - uses: DeterminateSystems/nix-installer-action@main + uses: DeterminateSystems/nix-installer-action@ef8a148080ab6020fd15196c2084a2eea5ff2d25 # v22 - name: Setup Nix Cache - uses: DeterminateSystems/magic-nix-cache-action@main + uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 # v13 - name: Regenerate bun.nix from bun.lock run: nix run --accept-flake-config github:nix-community/bun2nix -- -o bun.nix