From 7c0a9d4bded94728da329acaa6f8b43b9c3e711e Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sat, 29 Aug 2026 02:50:02 +0000 Subject: [PATCH] Add least-privilege permissions to GitHub Actions workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Declare explicit permissions on the workflows flagged by CodeQL (actions/missing-workflow-permissions, alerts #1–#9) so GITHUB_TOKEN is no longer the default write-all. Default contents: read at workflow level; escalate only on jobs that create releases or upload CodeQL results. Co-authored-by: Julian R --- .github/workflows/build.yml | 7 ++++++- .github/workflows/ci.yml | 5 ++++- .github/workflows/codeql-analysis.yml | 7 +++++++ .github/workflows/dev-build.yml | 3 +++ .github/workflows/dotnet-desktop-build.yml | 3 +++ .github/workflows/nightly-build.yml | 3 +++ .github/workflows/prod-build.yml | 3 +++ .github/workflows/release-drafter.yml | 6 ++++++ 8 files changed, 35 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 56c987ed..f7bc96b8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,10 +7,15 @@ on: pull_request: branches: [ "main" ] +permissions: + contents: read + jobs: build: runs-on: windows-latest - + permissions: + contents: write + steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 31b1e599..02f9250e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,10 @@ on: pull_request: # Run CI on PRs targeting dev branches: [dev] - + +permissions: + contents: read + jobs: build: name: Build on Windows diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 7e2ab1c8..1a10207e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -6,10 +6,17 @@ on: pull_request: branches: [dev, main] +permissions: + contents: read + jobs: analyze: name: Analyze runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write steps: - name: Checkout repository diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index d58f0090..f8aa5778 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -6,6 +6,9 @@ on: pull_request: branches: [ "dev" ] +permissions: + contents: read + jobs: build: runs-on: windows-latest diff --git a/.github/workflows/dotnet-desktop-build.yml b/.github/workflows/dotnet-desktop-build.yml index 2ce3a757..4b2f8295 100644 --- a/.github/workflows/dotnet-desktop-build.yml +++ b/.github/workflows/dotnet-desktop-build.yml @@ -6,6 +6,9 @@ on: pull_request: branches: [dev, main] +permissions: + contents: read + jobs: build-debug: name: build (Debug) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index bf80dd8b..a1c4fae1 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -5,6 +5,9 @@ on: # every day at midnight UTC - cron: '0 0 * * *' +permissions: + contents: read + jobs: nightly: name: Nightly Dev Build diff --git a/.github/workflows/prod-build.yml b/.github/workflows/prod-build.yml index 70942825..23f32dd3 100644 --- a/.github/workflows/prod-build.yml +++ b/.github/workflows/prod-build.yml @@ -5,6 +5,9 @@ on: branches: [main] workflow_dispatch: +permissions: + contents: read + jobs: prod: name: Production Release Build diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 809f0ced..4d12ad29 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -4,9 +4,15 @@ on: push: branches: [main] +permissions: + contents: read + jobs: update_release_draft: runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: read steps: - uses: actions/checkout@v4 - uses: release-drafter/release-drafter@v5