From d9a00ff284ceb7af0d058cea18132fd03c4c3382 Mon Sep 17 00:00:00 2001 From: Dmitriy Vasyura Date: Thu, 26 Nov 2026 05:26:50 -0800 Subject: [PATCH 1/2] build: restrict workflow token permissions Keep Pages deployment credentials in the deploy job and use read-only tokens for builds. Prevent checkout credentials from remaining available to later build steps. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++++ .github/workflows/gh-pages.yml | 14 +++++++++----- .github/workflows/release.yml | 7 +++++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index f6343890..05dc1d06 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -20,6 +20,8 @@ on: schedule: - cron: '30 18 * * 2' +permissions: {} + jobs: analyze: name: Analyze @@ -40,6 +42,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + persist-credentials: false # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index ae4404f1..7e8f18e2 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -5,11 +5,7 @@ on: branches: ["main"] workflow_dispatch: -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write +permissions: {} # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. @@ -21,9 +17,14 @@ jobs: # Build job build: runs-on: ubuntu-latest + permissions: + contents: read + pages: read steps: - name: Checkout uses: actions/checkout@v4 + with: + persist-credentials: false - uses: actions/setup-node@v4 with: @@ -50,6 +51,9 @@ jobs: # Deployment job deploy: + permissions: + pages: write + id-token: write environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e02d405b..690a0d11 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,6 +10,10 @@ on: branches: [ main ] workflow_dispatch: +# Release creation and asset uploads use PERSONAL_ACCESS_TOKEN. +permissions: + contents: read + jobs: publish: runs-on: ubuntu-latest @@ -18,6 +22,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 # All history + persist-credentials: false - uses: actions/setup-node@v4 with: node-version: '22' @@ -70,6 +75,8 @@ jobs: steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - uses: actions/setup-node@v4 with: From d8d998afe8d5498bccc762ce43e3bb18a6f9a992 Mon Sep 17 00:00:00 2001 From: Dmitriy Vasyura Date: Thu, 26 Nov 2026 05:27:35 -0800 Subject: [PATCH 2/2] build: keep permission changes independent of action pins Preserve checkout inputs so these permission restrictions merge cleanly with the existing action-pinning change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 2 -- .github/workflows/gh-pages.yml | 2 -- .github/workflows/release.yml | 3 --- 3 files changed, 7 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 05dc1d06..7bbce8ad 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -42,8 +42,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - with: - persist-credentials: false # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 7e8f18e2..9424103d 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -23,8 +23,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - with: - persist-credentials: false - uses: actions/setup-node@v4 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 690a0d11..a1ab5f1a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,7 +22,6 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 # All history - persist-credentials: false - uses: actions/setup-node@v4 with: node-version: '22' @@ -75,8 +74,6 @@ jobs: steps: - uses: actions/checkout@v4 - with: - persist-credentials: false - uses: actions/setup-node@v4 with: