From ee7c7bdaf94aaef84e1d0cb06ee55c3b33ada1f7 Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Mon, 17 Aug 2026 12:04:03 -0700 Subject: [PATCH] Add explicit GITHUB_TOKEN permissions to workflows Resolves the six open `actions/missing-workflow-permissions` CodeQL alerts (#1, #2, #4, #6, #7, #8) by declaring the least privilege each job needs. - ci.yml: one workflow-level `contents: read` covers all three jobs. `rspec` and `static_type_check` only check out the repo and run rspec / `srb tc`; `notify_on_failure` posts to a Slack incoming webhook and uses no GITHUB_TOKEN scope at all. - cd.yml: `contents: write` on the caller job. The shared-config cd workflow checks out with persisted credentials and runs discourse/publish-rubygems-action (`rake release` does a raw `git push` of the version tag), then `gh release create`. A caller-side grant is the ceiling for the reusable workflow, so anything less breaks the release. - stale.yml: `issues: write` + `pull-requests: write`. actions/stale comments on and closes both stale issues and stale PRs. - triage.yml: `issues: write` for `gh issue edit --add-label triage`. codeql.yml already declares its permissions and is left untouched. --- .github/workflows/cd.yml | 2 ++ .github/workflows/ci.yml | 3 +++ .github/workflows/stale.yml | 3 +++ .github/workflows/triage.yml | 2 ++ 4 files changed, 10 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 8cb675f..4c9ab97 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -8,5 +8,7 @@ on: jobs: call-workflow-from-shared-config: + permissions: + contents: write uses: rubyatscale/shared-config/.github/workflows/cd.yml@main secrets: inherit diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ffd7979..26532a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,9 @@ on: - main pull_request: +permissions: + contents: read + jobs: rspec: 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 diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml index 74bb1d9..7c492ee 100644 --- a/.github/workflows/triage.yml +++ b/.github/workflows/triage.yml @@ -6,4 +6,6 @@ on: - opened jobs: call-workflow-from-shared-config: + permissions: + issues: write uses: rubyatscale/shared-config/.github/workflows/triage.yml@main