From b60646fa38862a3a53c9d1619b28382a4f18bbb2 Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Mon, 17 Aug 2026 12:04:11 -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 four open `actions/missing-workflow-permissions` CodeQL alerts. Each scope is the least privilege the job actually needs: - build.yml (#5): workflow-level `contents: read`. The single `build` job only checks out, restores an `actions/cache` entry, and runs `npm ci` / `npm run build:prod` / `npm test`. Neither setup-node nor actions/cache needs a token scope beyond reading the repo. - publish.yml (#1): workflow-level `contents: read`. Despite the name, this tag-triggered job does not publish anything — it runs `vsce package` and hands the .vsix to `actions/upload-artifact`. Uploading an artifact needs no extra scope, there is no `vsce publish`, no `gh release create`, and no `npm publish`, so no write scope is warranted. The Marketplace release is done off the artifact, not by this token. - stale.yml (#2): job-level `issues: write` + `pull-requests: write`. The shared-config stale workflow runs `actions/stale`, which comments on and closes both stale issues and stale PRs. A caller's permissions are the ceiling for the reusable workflow, so both scopes must be granted here or the nightly cron silently stops closing things. - triage.yml (#4): job-level `issues: write`. The shared-config triage workflow only runs `gh issue edit --add-label triage`. Callers use job-level blocks immediately above `uses:`, matching the accepted precedent in rubyatscale/query_packwerk. codeql.yml already declares its permissions and is left untouched. --- .github/workflows/build.yml | 3 +++ .github/workflows/publish.yml | 4 ++++ .github/workflows/stale.yml | 3 +++ .github/workflows/triage.yml | 2 ++ 4 files changed, 12 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d2a9ead..9d5b381 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,6 +6,9 @@ on: - main pull_request: +permissions: + contents: read + jobs: build: strategy: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7a214e9..348814e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,6 +3,10 @@ on: push: tags: - 'v[0-9]+.[0-9]+.[0-9]+*' + +permissions: + contents: read + jobs: build: 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