From bde8a1ec546132645e5ec096371eafe781fa3d7c Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Mon, 17 Aug 2026 12:05:06 -0700 Subject: [PATCH] Add explicit GITHUB_TOKEN permissions to workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves the 10 open `actions/missing-workflow-permissions` CodeQL alerts (#1, #6-#14) by giving every job an explicit least-privilege scope. ci.yml: one workflow-level `contents: read`. All five jobs (ci-data, rspec, rspec_ruby_version_file, static_type_check, notify_on_failure) only check out the repo and run rake/srb, or post to a Slack incoming webhook — none of them writes anything back to GitHub. cd.yml: one workflow-level `contents: read` covering check-release (sparse checkout + a rubygems.org version probe), ci-data (oxidize-rb/actions/fetch-ci-data), build (checkout, cross-gem, upload-artifact) and notify_on_release (Slack webhook). The `release` job keeps its existing job-level `contents: write` override, which it needs for `gh release create`; job-level permissions replace rather than intersect the workflow-level block for normal jobs, so the release path is unaffected. stale.yml: job-level `issues: write` + `pull-requests: write` on the shared-config caller. A caller's permissions are the ceiling for the called workflow, and shared-config's stale.yml runs actions/stale, which comments on and closes both stale issues and stale PRs. --- .github/workflows/cd.yml | 3 +++ .github/workflows/ci.yml | 3 +++ .github/workflows/stale.yml | 3 +++ 3 files changed, 9 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 9917284..1c94ae6 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -17,6 +17,9 @@ group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true + permissions: + contents: read + jobs: check-release: name: Check if release needed diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ee03db..bc53d7e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,9 @@ on: - main pull_request: +permissions: + contents: read + jobs: ci-data: runs-on: ubuntu-latest diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 0287d52..2696450 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -5,4 +5,7 @@ on: - cron: '0 0 * * *' jobs: call-workflow-from-shared-config: + permissions: + issues: write + pull-requests: write uses: rubyatscale/shared-config/.github/workflows/stale.yml@main