Просмотр исходного кода

Pin the docker publish actions and scope two workflow tokens (#9200)

* Pin the docker and pages actions to full commits

The docker-publish workflow logs into Docker Hub and pushes the
official images, and its actions were referenced by version tags. A
tag is a movable pointer, whoever controls an action repository can
point it at different code after review, which is how the
tj-actions/changed-files incident (CVE-2025-30066) leaked CI secrets
at scale. A full commit cannot be retargeted. setup-ruby and
dockerhub-description were already pinned this way here, this extends
the same practice to the rest.

Each pin keeps the version as a trailing comment for review against
the action's releases page, versions stay exactly where they were,
and dependabot bumps commit pins the same way it bumps tags.

* Declare token permissions on the tests and description workflows

Both ran with the repository's default token grants and neither
writes through the GitHub token, the Docker Hub description update
authenticates with its own credentials. They drop to a read only
token, matching what docker-publish and the pages workflow already
declare.
Thibaud-Vdb 3 недель назад
Родитель
Сommit
9f00a04b11

+ 7 - 7
.github/workflows/docker-publish.yml

@@ -40,13 +40,13 @@ jobs:
             #  type=semver,pattern={{major}}.{{minor}}-alpine
             #  type=semver,pattern={{major}}.{{minor}}-alpine
     steps:
     steps:
     - name: Set up QEMU
     - name: Set up QEMU
-      uses: docker/setup-qemu-action@v4
+      uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
 
 
     - name: Set up Docker Buildx
     - name: Set up Docker Buildx
-      uses: docker/setup-buildx-action@v4
+      uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
 
 
     - name: Checkout
     - name: Checkout
-      uses: actions/checkout@v7
+      uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
 
 
     - name: Get FreshRSS version
     - name: Get FreshRSS version
       run: |
       run: |
@@ -56,7 +56,7 @@ jobs:
 
 
     - name: Add metadata to Docker images
     - name: Add metadata to Docker images
       id: meta
       id: meta
-      uses: docker/metadata-action@v6
+      uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
       with:
       with:
         flavor: ${{ matrix.flavor }}
         flavor: ${{ matrix.flavor }}
         images: |
         images: |
@@ -69,21 +69,21 @@ jobs:
 
 
     - name: Login to Docker Hub
     - name: Login to Docker Hub
       if: github.repository_owner == 'FreshRSS'
       if: github.repository_owner == 'FreshRSS'
-      uses: docker/login-action@v4
+      uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
       with:
       with:
         username: ${{ secrets.DOCKERHUB_USERNAME }}
         username: ${{ secrets.DOCKERHUB_USERNAME }}
         password: ${{ secrets.DOCKERHUB_TOKEN }}
         password: ${{ secrets.DOCKERHUB_TOKEN }}
 
 
     - name: Login to GitHub Container Registry
     - name: Login to GitHub Container Registry
       if: github.repository_owner == 'FreshRSS'
       if: github.repository_owner == 'FreshRSS'
-      uses: docker/login-action@v4
+      uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
       with:
       with:
         registry: ghcr.io
         registry: ghcr.io
         username: ${{ github.repository_owner }}
         username: ${{ github.repository_owner }}
         password: ${{ secrets.GITHUB_TOKEN }}
         password: ${{ secrets.GITHUB_TOKEN }}
 
 
     - name: Build and push Docker images
     - name: Build and push Docker images
-      uses: docker/build-push-action@v7
+      uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
       with:
       with:
         context: . # Switching from git context to path context, needed for .dockerignore to be applied. See: https://github.com/docker/build-push-action#git-context
         context: . # Switching from git context to path context, needed for .dockerignore to be applied. See: https://github.com/docker/build-push-action#git-context
         file: ${{ matrix.file }}
         file: ${{ matrix.file }}

+ 4 - 1
.github/workflows/dockerhub-description.yml

@@ -8,12 +8,15 @@ on:
       - edge
       - edge
   workflow_dispatch:
   workflow_dispatch:
 
 
+permissions:
+  contents: read
+
 jobs:
 jobs:
   dockerhub-description:
   dockerhub-description:
     if: github.repository_owner == 'FreshRSS'
     if: github.repository_owner == 'FreshRSS'
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
     steps:
     steps:
-    - uses: actions/checkout@v7
+    - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
 
 
     - name: Update repo description
     - name: Update repo description
       uses: peter-evans/dockerhub-description@1b9a80c056b620d92cedb9d9b5a223409c68ddfa
       uses: peter-evans/dockerhub-description@1b9a80c056b620d92cedb9d9b5a223409c68ddfa

+ 4 - 4
.github/workflows/jekyll-gh-pages.yml

@@ -29,7 +29,7 @@ jobs:
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
     steps:
     steps:
       - name: Checkout
       - name: Checkout
-        uses: actions/checkout@v7
+        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
       - name: Setup Ruby
       - name: Setup Ruby
         uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b
         uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b
         with:
         with:
@@ -38,13 +38,13 @@ jobs:
           cache-version: 1 # Increment this number if you need to re-download cached gems
           cache-version: 1 # Increment this number if you need to re-download cached gems
           working-directory: docs
           working-directory: docs
       - name: Setup Pages
       - name: Setup Pages
-        uses: actions/configure-pages@v6
+        uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
       - name: Build with Jekyll
       - name: Build with Jekyll
         run: |
         run: |
           cd docs
           cd docs
           bundle exec jekyll build --destination ../_site
           bundle exec jekyll build --destination ../_site
       - name: Upload artifact
       - name: Upload artifact
-        uses: actions/upload-pages-artifact@v5
+        uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
 
 
   # Deployment job
   # Deployment job
   deploy:
   deploy:
@@ -56,4 +56,4 @@ jobs:
     steps:
     steps:
       - name: Deploy to GitHub Pages
       - name: Deploy to GitHub Pages
         id: deployment
         id: deployment
-        uses: actions/deploy-pages@v5
+        uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0

+ 7 - 4
.github/workflows/tests.yml

@@ -6,6 +6,9 @@ on:
   pull_request:
   pull_request:
     branches: [ edge ]
     branches: [ edge ]
 
 
+permissions:
+  contents: read
+
 jobs:
 jobs:
 
 
   tests:
   tests:
@@ -14,7 +17,7 @@ jobs:
 
 
     steps:
     steps:
     - name: Git checkout source code
     - name: Git checkout source code
-      uses: actions/checkout@v7
+      uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
 
 
     # Composer tests
     # Composer tests
 
 
@@ -29,7 +32,7 @@ jobs:
 
 
     - name: Use Composer cache
     - name: Use Composer cache
       id: composer-cache
       id: composer-cache
-      uses: actions/cache@v6
+      uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
       with:
       with:
         path: vendor
         path: vendor
         key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
         key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
@@ -55,7 +58,7 @@ jobs:
     # NPM tests
     # NPM tests
 
 
     - name: Uses Node.js
     - name: Uses Node.js
-      uses: actions/setup-node@v7
+      uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
       with:
       with:
         # https://nodejs.org/en/about/previous-releases
         # https://nodejs.org/en/about/previous-releases
         node-version: lts/*
         node-version: lts/*
@@ -79,7 +82,7 @@ jobs:
 
 
     - name: Use shell cache
     - name: Use shell cache
       id: shell-cache
       id: shell-cache
-      uses: actions/cache@v6
+      uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
       with:
       with:
         path: bin
         path: bin
         key: ${{ runner.os }}-bin-shfmt@v3.8.0-hadolint@v2.12.0-typos@v1.29.9
         key: ${{ runner.os }}-bin-shfmt@v3.8.0-hadolint@v2.12.0-typos@v1.29.9