From 67dbb67ddcb3f72ead21b44a776181de95cf23dc Mon Sep 17 00:00:00 2001 From: SatoshiQaziMuhammed Date: Tue, 20 Oct 2026 23:00:03 +0400 Subject: [PATCH] ci: give every workflow an explicit least-privilege GITHUB_TOKEN (#16) CodeQL actions/missing-workflow-permissions: lock.yml, pr-any.yml, push-master.yml had no permissions block, so their jobs received the repository default token. Read-only where nothing writes through GITHUB_TOKEN; lock-threads gets the issues/pull-requests/discussions write it documents; workflows that write do it with a separate bot or app token, so GITHUB_TOKEN stays read-only. --- .github/workflows/lock.yml | 7 +++++++ .github/workflows/pr-any.yml | 5 +++++ .github/workflows/push-master.yml | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml index b26dc30..7e42c47 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -5,6 +5,13 @@ on: schedule: - cron: '10 1/3 * * *' + +# dessant/lock-threads locks closed issues, PRs and discussions. +permissions: + issues: write + pull-requests: write + discussions: write + jobs: lock: runs-on: ubuntu-latest diff --git a/.github/workflows/pr-any.yml b/.github/workflows/pr-any.yml index 541eb81..3d7fd1a 100644 --- a/.github/workflows/pr-any.yml +++ b/.github/workflows/pr-any.yml @@ -1,6 +1,11 @@ name: PR on: [pull_request] + +# Read-only token: no step writes through GITHUB_TOKEN. +permissions: + contents: read + jobs: pr: strategy: diff --git a/.github/workflows/push-master.yml b/.github/workflows/push-master.yml index 4082c93..3c4ba2c 100644 --- a/.github/workflows/push-master.yml +++ b/.github/workflows/push-master.yml @@ -4,6 +4,11 @@ on: branches: - master + +# Writes go through a separate bot token or app token; GITHUB_TOKEN stays read-only. +permissions: + contents: read + jobs: master: if: "! startsWith(github.event.head_commit.message, '[CI Skip]')"